I am new to google and am trying to create spreadsheets and then move it to a specific folder.
On the "Synthése Mag" sheet I have all the name I gave to the files.
The spreadsheet are successfully created, however, when I try to move it, the following message appear :
Exception: Unexpected error while getting the method or property getFolderById on object DriveApp.
My code is the following :
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Synthése mag'), true);
for(var i=2;i<4;i++){
var mag = spreadsheet.getSheetByName('Synthése mag').getRange(i,2).getValue ();
var ssNew = SpreadsheetApp.create(mag);
Logger.log(ssNew.getUrl());
var newmag = DriveApp.getFilesByName(mag)
DriveApp.getFolderById("Folder ID").addFile(newmag)
};
}
Anyone could help ?