javascript - 如何将我的值附加到谷歌电子表格 OAUTH/GAPI js
问题描述
我想创建 chrome 扩展,它使用 oauth 和 google apis(gapi) 在 google 表格中附加文本;你可以给我看代码示例吗?我在 background.js 中有这段代码
function onGAPILoad() {
gapi.client.init({
apiKey: API_KEY,
discoveryDocs: DISCOVERY_DOCS,
}).then(function () {
console.log('gapi initialized')
chrome.identity.getAuthToken({interactive: true}, function(token) {
gapi.auth.setToken({
'access_token': token,
});
gapi.client.sheets.spreadsheets.values.get({
spreadsheetId: SPREADSHEET_ID,
range: 'Sheet1',
}).then(function(response) {
console.log(response)
});
})
}, function(error) {
console.log('error', error)
})
}
解决方案
推荐阅读
- excel - 通过将活动单元格的范围提供给列的最后一行来显示自动填充命令范围中的错误
- process - 无法编译任何东西,无论正文如何,这是我得到的消息
- python - python:使用序列号编写 CSV 文件
- javascript - 如何通过转换使 div 在提交时消失?
- mysql - 存储多个值 MySQL
- android - android studio - 不需要的无限错误日志
- javascript - 根据元素获取数据
- html - 为什么我的整篇文章在 flex 容器中时会溢出它的边界?
- python - Pyspark 动态过滤数据框
- python - 有时即使循环任务结束,循环线程也会卡住而没有结束