![](/img/trans.png)
[英]Compare sheet 1 to sheet 2 and output to sheet 3. Google sheets. JavaScript
[英]Google sheets API JavaScript: Access sheet with auth
我可以從我的反應應用程序中訪問公共 google 表,但現在我正在嘗試使用憑據訪問表。 我找到了一個指導我設置憑據的教程,但該代碼對我不起作用。
const {google} = require('googleapis');
const keys = require('./interstitials-key.json');
const client = new google.auth.JWT(
keys.client_email,
null,
key.private_key,
['https://www.googleapis.com/auth/spreadsheets']
);
client.authorize(function(err, tokens){
if(err){
console.log(err);
return;
}
else{
console.log('connected');
}
});
我收到此錯誤:
“TypeError:預期
input
為Function
或Object
,undefined
”
這是一個已知問題,您可以在此處找到參考:
https://github.com/googleapis/google-api-nodejs-client/issues/1614
我轉載了,肯定沒修好,一調用庫就會遇到這個錯誤
const {google} = require('googleapis');
庫中使用的某些資源在客戶端不可用,因此無法從 React 端調用它,因此您要么在服務器端使用它,要么必須使用 google javascript 客戶端 api。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.