Home > OS >  How to get nerw file ID after DriveApp moveTo
How to get nerw file ID after DriveApp moveTo

Time:08-30

var idRisultati = DriveApp.getFileById(ssNew.getId()).moveTo(DriveApp.getFolderById(idCartellaEsame));
  
var ssNeww = SpreadsheetApp.openById(idRisultati.getId());

The "move to" operation works fine and the file appears in the desired folder, but IdRisultati contains only the name of the new file created. How can I obtain the new file Id?

CodePudding user response:

Try it this way:

const file = DriveApp.getFileById(ssNew.getId()).moveTo(DriveApp.getFolderById(idCartellaEsame));
  
var ssNeww = SpreadsheetApp.openById(file.getId());
  • Related