APPS Script OpenByName

var id = newSS.getId(); //where newSS is your new spreadsheet
PropertiesService.getScriptProperties().setProperty('id', id);
Thoughtful Turtle