简体   繁体   English

无法读取未定义的属性“电子表格” - 谷歌电子表格

[英]Cannot read property 'spreadsheets' of undefined - google spreadSheet

I have problem like as title.我有标题这样的问题。 I sign in oauth2 and google return error我登录 oauth2 和谷歌返回错误

"Cannot read property 'spreadsheets' of undefined". “无法读取未定义的属性‘电子表格’”。 I tried copy sample from google page and same error;我尝试从谷歌页面复制样本,但出现同样的错误;

   function makeApiCall() {
        var spreadsheetBody = {
            // TODO: Add desired properties to the request body.
        };

        var request = gapi.client.sheets.spreadsheets.create({}, spreadsheetBody);
        request.then(function(response) {
            // TODO: Change code below to process the `response` object:
            console.log(response.result);
        }, function(reason) {
            console.error('error: ' + reason.result.error.message);
        });
    }

    function initClient() {


        var SCOPE = 'https://www.googleapis.com/auth/spreadsheets';

        gapi.client.init({
            'apiKey': 'myke',
            'clientId': 'myclientID',
            'scope': SCOPE,
            // 'discoveryDocs': ['https://sheets.googleapis.com/$discovery/rest?version=v4'],
        }).then(function() {
            gapi.auth2.getAuthInstance().signIn();
            gapi.auth2.getAuthInstance().isSignedIn.listen(updateSignInStatus);
            updateSignInStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
        });
    }

    function updateSignInStatus(isSignedIn) {
        if (isSignedIn) {
            makeApiCall();
        }
    }


    gapi.load('client:auth2', initClient);

It's because you've commented out the "Discovery Docs" line.这是因为您已注释掉“Discovery Docs”行。 GAPI needs to know the discovery docs in order to load the correct API endpoints. GAPI 需要知道发现文档才能加载正确的 API 端点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google 电子表格错误 TypeError:无法读取未定义的属性“过滤器” - Google spreadsheet error TypeError: Cannot read property 'filter' of undefined Nodejs 和 Google 电子表格集成(无法读取 undefined 的属性“长度”) - Nodejs And Google spreadsheet Integration ( Cannot read property 'length' of undefined ) Google图表:无法读取未定义的属性“ 0” - Google Charts: Cannot read property '0' of undefined 无法读取谷歌图表中未定义的属性“计数” - cannot read property 'count' of undefined in google charts 无法读取未定义的属性“地图”-Google图表 - Cannot read property 'map' of undefined - Google chart 无法在Google Oauth中阅读未定义的属性'authorize'吗? - Cannot read property 'authorize' of undefined in Google Oauth? Google地图:无法读取未定义的属性“几何” - Google Maps: Cannot read property 'geometry' of undefined “无法读取未定义的属性‘zindex’”谷歌地图 - “Cannot read property 'zindex' of undefined” Google maps 无法从未定义中读取属性 - Google 脚本 - Cannot read property from undefined - Google Script Google图表:“无法读取未定义的属性'toLowerCase'” - Google Chart: “Cannot read property 'toLowerCase' of undefined”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM