Alejandro Rosales
Alejandro Rosales

Reputation: 141

How to create Google scripts on desktop using WebStorm?

Scripting on google's IDE is a big pain, it's very laggy and it just sucks.

How can I make the google script editor work on my PC?

I tried downloading this Clasp

Also I added a library from google to javascript.

but when I run it it gives me this error:

var ss = SpreadsheetApp.getActiveSpreadsheet();
           ^

ReferenceError: SpreadsheetApp is not defined

How can I fix this?

What I'm basically trying to do with this script is to send an email based on a bunch of conditions on a google sheets.

Upvotes: 4

Views: 1336

Answers (2)

Mateo Randwolf
Mateo Randwolf

Reputation: 2920

In order to be able to run an Apps Script project remotely from your local machine, you need to use the clasp command run as you will be required to also use some kind of authorization (you will basically need to connect your local project to your remote Apps Script project and verify it is you the one trying to run it).

Here is a complete guide on how to use this command but just to summarise a bit you basically will need to set up a Project ID and create an OAuth Client ID to then be able to login using the credentials obtained from it clasp login --creds creds.json1.

This is an example of running a function using the command run:

clasp run 'functionName'

Upvotes: 4

Dalton Gray
Dalton Gray

Reputation: 41

Adding the google-apps-script library to webstorm might also help you out.

Follow the instructions here, but search for "google-apps-script" in the download library modal. Instead of "chrome" which is what this article is about.

How do I use WebStorm for Chrome Extension Development?

You'll then be able to create *.gs files. Open them as javascript.

Upvotes: 2

Related Questions