我只粘贴了我试图单独运行的部分代码。
function myFunction() {
var files = DriveApp.searchFiles('title contains "Companies_OHLC_0"');
while (files.hasNext()) {
var spreadsheet = SpreadsheetApp.open(files.next());
}
}
它曾经工作过一段时间,但我现在不断收到此异常:
Exception: Unexpected error while getting the method or property open on object SpreadsheetApp. (line 4, file "Code").
最佳答案
我明白了。 我有多个同名文件,因此,我遇到了这个异常。
我运行了其他脚本,这些脚本创建了具有相同名称的新文件。我没有注意到这一点。我删除了所有重复的文件,并且不再遇到此异常。
关于google-apps-script - 如何修复 "Exception: Unexpected error while getting the method or property open on object SpreadsheetApp"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62964344/