【发布时间】:2021-11-30 04:42:26
【问题描述】:
我知道我的问题听起来有点拗口,所以让我澄清一下:我需要做一些事情,比如将数据从 Google Sheet 带到 AWS(即 Athena),反之亦然。
但是,由于无论如何都需要Google API,我惊讶地发现require()根本不是这种JS孪生语言中的函数。那么,我们如何在上面使用任何第三方库呢?
示例 (github repo):
const {google} = require('googleapis');
【问题讨论】:
-
您想使用什么 Google API?而且,来自
I need to do something like bringing data from Google Sheet to AWS (i.e. Athena), or vice versa.,在这种情况下,我认为在 Google Apps 脚本方面,可能不需要使用 Sheets API。我认为您可以使用Google Spreadsheet service 和Class UrlFetchApp 来实现这一点。如果我误解了您的目标,我深表歉意。 -
fs呢?我需要从 json 文件中读取凭据。那么有什么选择吗?而且似乎我们无法将任何像 .json 这样的文件上传到编辑器。这让我很恼火,因为我需要使用我的凭据。
-
顺便说一句,基本上我在找
google.auth.OAuth2。 -
感谢您的回复。关于
What about fs? I need to read the credentials from a json file. So any alternative?,您可以从 Google Drive 上的文件中检索数据。关于And it seems that we have no way to upload any files like .json to the editor.,编辑是什么?关于It annoys me because I need to use my credentials.,对此我深表歉意。关于BTW, essentially I am looking for google.auth.OAuth2.,不幸的是,Google Apps 脚本没有google.auth.OAuth2。但我认为可能可以考虑解决方法。那么,我可以问一下你的目标细节吗?
标签: javascript node.js google-apps-script google-sheets google-api