6

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.

1 Answer 1

10

SOLVED, just I have to save the template file as a google spreadsheet document (it was xlsx) and now works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.