'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.
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):
var WorkingBook = SpreadsheetApp.openById(DuplicateID);
The error I received:
Error
Exception: Service Spreadsheets failed while accessing document with id -----Spreadsheet 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.
Solution 1:[1]
SOLVED, just I have to save the template file as a google spreadsheet document (it was xlsx) and now works.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Duxi |
