Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy a Google Apps Script web app with clasp?

I am using clasp to manage a Google Sheets Script (web app)

I tried to make a new deploy according to the instructions using: clasp deploy --deploymentId abcd1234

The command went through without errors. I can see a new version of the script created but the deployment is not updated: no deployment is made.

like image 807
Juuso Nykänen Avatar asked Oct 21 '25 16:10

Juuso Nykänen


1 Answers

I found this conversation when digging deeper.

Summary: You need to add some code to your manifest file appscript.json:

  "webapp": {
    "access": "MYSELF",
    "executeAs": "USER_DEPLOYING"
  },

The whole appscript.json file should look like this (so you can see where to place the code:

{
  "timeZone": "America/New_York",
  "dependencies": {
  },
  "webapp": {
    "access": "MYSELF",
    "executeAs": "USER_DEPLOYING"
  },
  "exceptionLogging": "STACKDRIVER"
}

Furthermore here is an overview of the different options available (full documentation here https://developers.google.com/apps-script/manifest/web-app-api-executable?hl=fr#webapp):

"webapp": {
    "access": "MYSELF"
    "access": "DOMAIN"
    "access": "ANYONE"
    "access": "ANYONEANYONE_ANONYMOUS",
    "executeAs": "USER_DEPLOYING"
    "executeAs": "USER_ACCESSING"
    "executeAs": "ANYONE_ANONYMOUS"
  },

After updating the manifest file push the changes using clasp push. Then deploy with the commands in the instructions: clasp deploy --deploymentId abcd1234

Additional note to anyone new to clasp: there is a difference between version and deployment. A version is similar to a git tag (a way of keeping track of code), while a deployment is actual code that is being used for execution.

like image 140
Juuso Nykänen Avatar answered Oct 25 '25 12:10

Juuso Nykänen