我将Google Sheets API与NodeJS结合使用,并尝试从https://developers.google.com/sheets/api/quickstart/nodejs中进行最简单的演示

我收到运行时错误“ google.sheets不是函数”。在检查时,我得到了下面的调试屏幕截图,

node.js - 无法解析Google Sheets API中的google.sheets-LMLPHP

google变量来自var google = require("googleapis");,似乎加载得很好(里面有很多内容)。它的属性似乎没有“ sheets”属性,因此执行结果将表明它不是函数。

没有人在网上问类似的问题。我是否错过了一个非常明显的设置步骤?

最佳答案

将导入更改为:

var {google} = require("googleapis");

关于node.js - 无法解析Google Sheets API中的google.sheets,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47822095/

10-14 17:56
查看更多