Reputation: 33
I know it's a long shot however, do you know if it is possible to attach a script to a spreadsheet you create in a script?
pseudo code version would be
function create_spreadsheet
new spreadsheet = ... creates spreadsheet
new spreadsheet = ... fills with appropriate formatting
-Need help part is -
new spreadsheet add script = ... Attach Following script to the new spreadsheet.
-Need help part is -
Upvotes: 3
Views: 110
Reputation: 382
You can use the AppsScript REST API (aka "advanced API") to programmatically manage AppsScript projects. See https://developers.google.com/apps-script/api/how-tos/manage-projects This includes the ability to create "bound" projects (i.e., bound to a specific Sheet) and upload new content to that project's files.
However, to use the REST API from AppsScript code you'll need to enable the "advanced API". See https://developers.google.com/apps-script/guides/services/advanced.
Upvotes: 1
Reputation: 1264
I have not gotten to try it yet, but rather than creating a spreadsheet you could copy a public version of a spreadsheet that includes the script.
Upvotes: 0