5 Great Features in the new Google Apps Script Editor for Beginners
The new editor (Integrated Development Environment — IDE) for Google Apps Script is out! There is a lot of features in the new editor to make your lives easier; here’s my top 5 favorites that I think are helpful for beginners to write and manage their scripts.
If you are new to scripting, you’ll notice whenever you start a new line, the editor generally places the cursor in the best spot to keep your loops, functions, etc. nicely indented.
However, once you start going back to edit code, or you start to copy and paste some code online into your code, it starts to look messy.
In the new editor, auto-format is here to save you! Simply right click and select Format Document (or press Shift+Alt+F) and it’ll fix all that for you!
2. Function/Section Markings and Folds
Once you get all your code nicely formatted, you’ll notice sections of code (e.g. lines of code inside a function, loop or if/else statements) are decorated so you can visualize the start/end of a block of code.
If you hover over to the line number in the beginning of the block, you’ll get the control to hide/show that block — this is very handy if your code gets long, or if you’re not actively working on that part of the code, and you want to tuck it away to focus on the parts you are working on instead!
TIP: Hit F1 and type “Fold” or “Unfold”- you’ll get shortcut options like Fold All and Unfold All!
3. Better Syntax Highlighting
While the old editor did have syntax highlighting, the new editor does it better, and fits better with the new V8 engine released earlier this year for Apps Script…so when you do start dabbling into things like creating classes, the code will read better.
4. Execution Log
I used to have the Apps Script Dashboard on a separate tab on my browser to review full error messages when I test my code, as well as read any console messages my code prints out. Now it’s just right there on the editor.
5. Documentation, Right at your Fingertips
…how exactly do I send an email again…? While you may still need to remember a couple things, like the existence of “GmailApp” class that can be used to help you send email, the auto-complete suggestions and documentation that comes with the new editor will help you figure out the rest. Simply type in what you remember and scroll through to find the right functions for your needs!
TIP: I personally don’t always remember or know all the features and functions available in Apps Script, so I tend to just start typing the following classes/functions and explore the docs, based on what I need:
- If I need to do something with emails, I would type “GmailApp.” to start exploring
- Spreadsheet related —type “SpreadsheetApp.” , or “SpreadsheetApp.getActiveSpreadsheet().”- to do something with the spreadsheet my script is bound to
- Manipulating/managing files in Drive (e.g. copying a file, grant permissions) — type “DriveApp.”