Create and Host a website with Apps Script. Work locally using your favorite IDE. Use HTML, CSS, and JavaScript to design your pages. Use clasp
to push your code files to Google Drive and to deploy your site to Google Cloud Platform.
This project uses npm to install clasp. The clasp CLI lets you work on Google Apps Scripts locally and then push and deploy changes from your Terminal or IDE.
It is recommened you create a new repository using GitHub's template feature. Your new repository will contain this project's files and folder structure, but you will have a fresh history of changes.
Above the README and file list in this GitHub repository, click Use this template. Chose the settings that fit your needs.
git clone git@github.com:<YOUR_GITHUB>/<YOUR_REPO_NAME>
cd AppsScript-HTML-Starter
npm install
Run clasp login
. This will open a browser where you must login and click through to grant clasp access to a few Google services. Once complete, return to your terminal or IDE.
https://script.google.com/home/usersettings
Turn on Google Apps Script API and return to your terminal or IDE.
Use clasp
to create a new blank Apps Script project. Set the type, title, and directory.
clasp create --type webapp --title "AppsScript-HTML-Starter" --rootDir ./
Run clasp push
to send your changes to Google Drive (aka script.google.com).
clasp push
└─ Code.gs
└─ appsscript.json
└─ index.html
Pushed 3 files.
Run clasp deploy
to deploy your app to GCP. Within your project, a new version is created and then published.
clasp deploy
Created version 1.
- AKf...LEQ @1.
Run clasp open --webapp
and use arrow keys to select the version you just created.
clasp open --webapp
? Open which deployment? (Use arrow keys)
❯ @HEAD - AKf...h2S
If everything worked, you should see the Hello Apps Script! welcome page.