0
votes

I have a stand-alone google app script I would like to copy multiple times in the same Drive folder and I need each copy to be published as a web app.

I've read the DRIVE REST API and the import/export documentation and viewed the tutorial at https://www.youtube.com/watch?reload=9&v=lEVMu9KE6jk to work on projects but is there an easier way to just copy/paste the existing script into the same folder?

Also, is there a way to auto-publish the copy of the project as a web app?

1
About copy/paste an App Script project file, can you provide the detail information about copy/paste? You want to copy a project file as new project file? Or you want to copy the part of script in the project as a string value, and paste it to new project file? The former and later can be achieved by files.copy method of Drive API and projects.getContent and projects.create of Apps Script API, respectively.Tanaike
About auto-publish the copy as a web app, when you want to deploy the new project file as Web Apps using script, you can achieve it using projects.versions.create and projects.deployments.create of Apps Script API. But in this case, if the methods which are required to authorize are included in the script of Web Apps, it is required to manually authorize.Tanaike
About copy/paste an App Script project file, I want to copy a project file as new project file. But I will try projects.getContent and projects.create.Alistair Ian Dgb Brownlee
Thank you for replying. If your issue was resolved, I will be glad.Tanaike

1 Answers

0
votes
var thisID = ScriptApp.getScriptId()
var thisScript = DriveApp.getFileById(thisID)
thisScript.makeCopy()

This will copy the current script. The publishing process must be done manually in the editor, or by using the Apps Script API