Reputation: 21
as Title.
I utilized Google App Script to copy an existing spreadsheet to a new one. It was created at the root directory. How can I create a spreadsheet at the current folder where the code file located?
Thanks!
Upvotes: 0
Views: 770
Reputation:
If you're using the makeCopy()
method, you can pass the destination directory where you want the file to be created:
function leFunction(){
var spreadsheet = SpreadsheetApp.openById('spreadsheetId');
var destFolder = DriveApp.getFolderById('FolderId');
DriveApp.getFileById(spreadsheet.getId()).makeCopy(destFolder);
}
Upvotes: 2