Tag: google spreadsheet api

如何使用谷歌驱动器API创build电子表格文件,并将默认标签标题设置为“Sheet1”以外的内容

我想通过谷歌驱动器(v3)API创build一个电子表格,其中: 我上传一个CSV数据来填充第一个标签 我可以将选项卡的名称设置为“Sheet1”以外的其他名称 我花了整晚爬行谷歌API的工作表(V4)和驱动器(V3),但仍然无法弄清楚这一个! 如果我不能这样做,似乎我将不得不发送一个额外的请求来更新工作表属性来改变标题后,我做了第一次上传。 如果可能,我想尽量避免,但我意识到这可能是唯一的方法。 以下是我要发送的API请求: let fileMetadata = { name: name, title: 'rawData', //This does NOT get set! Tab appears as "Sheet1" mimeType: 'application/vnd.google-apps.spreadsheet' } let media = { mimeType: 'text/csv', body: data // The body data is the raw parsed CSV } var Google = google.drive('v3') Google.files.create({ auth: auth, media: media, resource: […]

Google电子表格api请求的authentication范围不足

我正在使用nodejs上的以下脚本制作脚本以从Google电子表格中读取数据: var url = oauth2Client.generateAuthUrl({ access_type: 'offline', approval_prompt: 'force', scope: [ 'https://www.googleapis.com/auth/analytics.readonly', 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/spreadsheets' ] }); global.googleapis = { expiry_date: 0 }; google.options({ auth: oauth2Client }); var sheets = google.sheets('v4'); sheets.spreadsheets.get({ spreadsheetId: 'id'}, function(err, data) { res.send(err, data); }); 但在每一个请求我得到这个错误: Request had insufficient authentication scopes. 我查看了Google开发者控制台,启用了Google Drive API,并启用了它,所以我不知道它会是什么。