Saturday, May 11, 2013

VBA and Google Apps Script Side-By-Side

Appendix A, provisionally entitled  "Appendix A: Excel VBA And Google Apps Script Comparison"
has been added to my book Google Spreadsheet Programming

Download the free sample which includes the appendix covering common spreadsheet programming tasks in both VBA and Google Apps Script.

Please send me any comments or suggestions that you have so that I can add to and improve the material it contains.  More content will be added in due time.

Some Notes On Google Apps Scripts and VBA

The most common type of request that I receive from readers is how to translate Excel VBA into Google Apps Script.  Google Spreadsheets implements most of the standard spreadsheet functions in addition to a few of its own.  However, from a programming perspective Excel and Google Spreadsheets are quite different:

  • VBA is the last survivor of the old pre-VB.NET VB lineage with the main branch ending at VB6.  Google Apps Script is a JavaScript dialect with a very different syntax and philosophy from VBA.  Use of semi-colons to end statements, curly braces to delimit code blocks, and case sensitivity are just a few of the more obvious ways in which Google Apps Script differs from VBA.
  • Google Apps Script, being a JavaScript dialect, comes with some really useful productivity enhancers such as functions as first class objects, very flexible data structures in the form of its arrays and objects, and built-in regular expressions.  See Douglas Crockford's very well-known O'Reilly title JavaScript The Good Parts for all the details.

However, both languages are hosted within applications and are used as the "glue" to integrate applications.  Their APIs are therefore quite similar in philosophy if not in detail.

Check out the PDF and let me know what you think!

Update 22-May-2013
I'm getting positive feedback on this blog entry so there is clearly some interest in this. Accordingly, I will continue to update the PDF with additional code examples.  Suggestions or examples are also very welcome!


  1. If you learn Dart, and don't learn JavaScript, will you be able to understand Google Apps Script? Thanks.

  2. Hi Jeff, I know very little about Dart and I don't know if it will have any direct bearing on Google Apps Script (GAS). However, GAS is really just JavaScript so, regardless of what Dart turns out to be, learning GAS means learning JavaScript.

    Hope that helps