A template repository to develop a Google Sheet add-on with Svelte + Vite.
-
Clone the repository and install npm dependencies. Please note that there are two projects that you need to install npm packages(one for the sidebar and the other one for the clasp).
git clone https://github.com/basil2style/google-sheet-addon-svelte-starter my-project cd my-project npm install
-
Log in and authenticate with your Google account:
npm run clasp:login
You can also use npx for running clasp locally
-
Create a new Sheet project:
npm run clasp:create
Make sure that you've .clasp.json and appsscript.json files on the root folder before deploying.
-
Deploy the project:
npm run deploy
-
Open the project:
npm run clasp:open
The sidebar/dist directory contains the bundled svelte code. We will copy the index.html from the dist folder to /src using the build:post script.
This is similar to .gitignore. You can use this to include only the necessary files.
Once you followed the steps above and have the Apps Script project open, the following steps explain how to test the add-on:
- Click Extensions, then Select our Addon...
- Select Open to run the HTML file.
This opens the Svelte sidebar.
Navigate to the sidebar
folder and develop & test the application as you would any regular Svelte application, i.e. npm run dev
.
I added Pico CSS framework for this project, but you can change it to your framework
No routing library added. Also, you can't use Sveltekit routing here.
Coming Soon..
- CLASP - Google Apps Script tutorial
- google-docs-addon-svelte-template -- Last Updated Mar 2020