Reputation: 43
I'm trying to start editing Google Apps scripts that are bounded to Google Sheets.
I don't understand the part where it is documented that
Structure Code. clasp automatically converts your flat project on script.google.com into folders. For example:
├── tests/slides.gs
└── tests/sheets.gs
├── tests/
│ ├─ slides.gs
│ └─ sheets.gs
When I see my projects on script.google.com they are just listed by the name, I don't see any folder structure.
I was able to to a clasp clone PROJECT_ID and it downloaded 3 files
Cloned 3 files.
└─ appsscript.json
└─ Code.js
└─ Old Code.js
exactly to the folder where I ran the clasp command.
I don't see how it creates folders for me..
Should I be creating one folder per script?
Thanks in advance
Upvotes: 3
Views: 1529
Reputation: 9872
On script.google.com, the files will always be in a flat structure. What clasp does is--if there is a filepath separator in the .gs filename--nests that into a folder in your local Dev environment.
So if your gs files are "a.gs" and "old b.gs", they will be in the same directory when you clasp pull
. If they are named ”a.gs" and "old/b.gs", when you clasp pull
, the current directory will contain a js file named "a.js" and a directory named "old", which contains a file named "b.js".
Similarly, if you create a directory-based project locally and then push it to Apps Script, clasp will flatten suitable files in your local directory so Apps Script can use them.
I.e.
webapp/
- a.js
- b.js
main.js
Will become
webapp/a.gs
webapp/b.gs
main.gs
after pushing.
PS: shared development may be tricky in multi-OS teams while this bug is open: https://github.com/google/clasp/issues/393
Upvotes: 6
Reputation: 11268
Google Script editor doesn't support folders, all files are always uploaded into the root.
Upvotes: 1