I am struggling with creating a script that will copy a file located on a Team Drive to My Drive for many users. I do not know how to implement a part to find My Drive of the user, it cannot be a static url address.
function saveAsSpreadsheet(){
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var name = sheet.getName()
var drive = ???
var name = Browser.inputBox('Save File', 'Enter the name of the file',
Browser.Buttons.OK_CANCEL);
if (name != "cancel"){
DriveApp.getFileById(sheet.getId()).makeCopy(name,drive);
}
}
Thank you for suggestions!