Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script Google Apps脚本:获取对象SpreadsheetApp上的openById方法或属性时发生意外错误_Google Apps Script_Google Sheets - Fatal编程技术网

Google apps script Google Apps脚本:获取对象SpreadsheetApp上的openById方法或属性时发生意外错误

Google apps script Google Apps脚本:获取对象SpreadsheetApp上的openById方法或属性时发生意外错误,google-apps-script,google-sheets,Google Apps Script,Google Sheets,我的google sheets apps脚本有一个doGet()函数,它接受HTTP get请求,解析查询参数并将其放入电子表格中 当我使用get请求测试应用程序时,我收到一条“500内部错误消息”,然后我测试了部署,并收到错误消息“Exception:在获取对象SpreadsheetApp上的方法或属性openById时出现意外错误”。(第9行,文件“代码”) 因此,打开图纸时出现问题,但我确信我在查看项目设置时有正确的图纸ID。我认为这可能是谷歌硬盘的问题,所以我用一个空白硬盘和一个新的电子

我的google sheets apps脚本有一个doGet()函数,它接受HTTP get请求,解析查询参数并将其放入电子表格中

当我使用get请求测试应用程序时,我收到一条“500内部错误消息”,然后我测试了部署,并收到错误消息“Exception:在获取对象SpreadsheetApp上的方法或属性openById时出现意外错误”。(第9行,文件“代码”)

因此,打开图纸时出现问题,但我确信我在查看项目设置时有正确的图纸ID。我认为这可能是谷歌硬盘的问题,所以我用一个空白硬盘和一个新的电子表格创建了一个全新的谷歌账户,但同样的错误出现了!?我不知道这里发生了什么,所以任何帮助都将不胜感激!代码如下:


如注释所示,代码中的工作表ID不是标准的44字符格式,因此错误500是由
openById()
方法引发的


解决方案是使用一个指向未删除的Google工作表的有效文件ID。

该电子表格ID看起来很长,因此我怀疑它是否确实正确。我熟悉的ID通常是44个字符。您可以尝试改用该方法。谢谢,他有点傻,使用了脚本ID。。新的IDE让我有点困惑