To Open Spreadsheet

var spreadsheet = SpreadsheetApp.openByUrl(url);
// url = "https://docs.google.com/spreadsheets/d/xxxxxxxxx/edit..."
var spreadsheet = SpreadsheetApp.openById(id);
// url = "https://docs.google.com/spreadsheets/d/xxxxxxxxx/edit..."
// id = "xxxxxxxxx"