Rearrange files in Google App Script editor

360 views
Skip to first unread message

Edward Ulle

unread,
Aug 2, 2022, 10:27:02 AM8/2/22
to Google Apps Script Community
I have resurrected an old web app project that has classes and inheritance.  I rearranged files alphabetically and now, with the new editor, the ineritance is broken.  If a class inherits from another class I have to move the parent class file above the extended class.  I can do it moving files up and down but there are quite a few files and its taking a long time.  I was hoping there is an easier way.

These classes were developed using the old class method   function name(value) {}, not the new   class name {} method.

Clark Lind

unread,
Aug 2, 2022, 9:53:29 PM8/2/22
to Google Apps Script Community
Get the script ID. Then go to the projects API (get Content method) and paste the scriptID in the API test form and execute. Give permissions and let it run. It will provide an Object. Copy the text of the Object and paste into your favorite editor (e.g., VSCode). 
Within the "files" section is an array of file objects. Rearrange them in the desired order. When finished, go back to the API and this time use the Update Content method. Paste in the scriptID, and in the Request Body area, paste in just the "files" array between the brackets. And execute. Go to the IDE and refresh, the files should be reordered. 

I just tried this on a simple project, and it works, so try a small project with just a couple files first.   Good luck!

Edward Ulle

unread,
Aug 3, 2022, 12:50:20 PM8/3/22
to Google Apps Script Community
Thanks.  I rearranged manually after an hour or so.  But now I'm experiencing a different problem.  I can't use "let"  if I change "var" to "let" I get an error message and can't save the code.

Syntax error: Missing ; before statement. line: 45 file: Node.

Even if I try something as simple as this.

for( let i=1; i<=n; i++ ) {

I'm using the new editor.  Its as though it doesn't recognize the latest javascript syntax.

Edward Ulle

unread,
Aug 3, 2022, 12:51:54 PM8/3/22
to Google Apps Script Community
I found it " Enable Chrome V8 runtime"

CBMServices Web

unread,
Aug 3, 2022, 1:03:37 PM8/3/22
to google-apps-sc...@googlegroups.com
It is not the editor that enabled let and the new syntaxes. It is v8 version that did that. Look at manifest and ensure you are using the v8 version rather than older platform.


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/ff318a93-8121-40b7-815f-b0cdaddb6e70n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages