These articles are abridged from my  book on Apps Script.
Going GASfrom VBA to Google Apps Script. Now available from O’Reilly or Amazon

If you’ve ever had to go through and fix up formatting on a large Google Doc, you’ll know what a pain it can be. Here’s how to automate it.

Formatting tables

In this example, I wanted a parameter driven solution that searched through a document and set various attributes of all tables with just 1 cell in them – I use these to publish source code.
Additionally, the formats had to be slightly different depending on whether the code language was VBA or Apps Script.
Specifically, JavaScript would look like this
and VBA like this

The code

It’s pretty straightforward – simply set up the attributes that need to be set, the value to change them to, and which type of table (in my case I assigned the types VBA and JS) to apply the changes to. Note this example is specific for 1 cell tables, but that can me modified with a small adaptation.
For more like this see Google Apps Scripts Snippets
Why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.