[英]Exception: Service Spreadsheets failed while accessing document with id
Google Script can't access to a spreadsheet created by it, but can open a spreadsheet created by me. Google Script 无法访问它创建的电子表格,但可以打开我创建的电子表格。
This is working (the spreadsheets were created by me):这是有效的(电子表格是由我创建的):
var DataBookID = MasterSheet.getRange("B4:G5").getValue();
var Data = SpreadsheetApp.openById(DataBookID);
This is not working (spreadSheet duplicated via google script):这不起作用(通过谷歌脚本复制了 spreadSheet):
var WorkingBook = SpreadsheetApp.openById(DuplicateID);
The error I received: Error我收到的错误:错误
Exception: Service Spreadsheets failed while accessing document with id -----Spreadsheet ID------.异常:服务电子表格在访问 ID 为 ----- 电子表格 ID ------ 的文档时失败。
The duplicate method:复制方法:
//DUPLICATE TEMPLATE
var destFolder = DriveApp.getFolderById(DestFolderID);
DriveApp.getFileById(TemplateID).makeCopy(BookName, destFolder);
EDIT: If I try this, it gives me the same error:编辑:如果我尝试这样做,它会给我同样的错误:
var testing = DriveApp.getFileById(TemplateID).makeCopy(BookName, destFolder);
SpreadsheetApp.open(testing).getRange("A8").setValue("AAAAAA");
I don't know why it gives me this error.我不知道为什么它会给我这个错误。 Thanks in advance.
提前致谢。
SOLVED, just I have to save the template file as a google spreadsheet document (it was xlsx) and now works.已解决,只是我必须将模板文件保存为谷歌电子表格文档(它是 xlsx),现在可以使用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.