I have a master spreadsheet which contains a script that makes a POST request to my server onEdit with the current spreadsheet ID.
function post2Server(){
ss = SpreadsheetApp.getActiveSpreadsheet();
payload = {};
payload['spreadsheet_id'] = ss.getId();
headers = {
'Content-Type': 'application/json',
'Accept' : 'application/json'
}
options = {
'method' : 'post',
'contentType': 'application/json',
'headers' : headers,
'payload' : JSON.stringify(payload)
}
res = UrlFetchApp.fetch(MY_SERVER_URL, options);
return;
}
This function works as intended on the master sheet. Now, when I use the python google API to create a copy of this master sheet, the script copies over, however, doesn't run. I get an error saying....
Server error occurred. Please try saving the project again.
Why isn't this running? Within the copy of the spreadsheet, I even create a new function which simply logs "hello" and receive the same error. It appears that after the Python SDK copied the master sheet, no functions run. Is this a permissions issue? How can I get the script to execute in any subsequent copy of the master sheet?