What is the Execution API ?
This is a brand new API that enables the running of Apps Script functions from other processes via JSON REST requests, or by using a library specific to your development language. Although it can be run from Apps Script, its main function is to provide access to Apps Script capabilities from other platforms. The libraries and developer tools quickstart can be found here.
There is some similarity to the google.script.run namespace, whose function is to enable add-on/HtmlService communication between client and server. Although probably not the purpose for which it was envisioned, this API is also a powerful tool to enable incremental migration from Office (or anything else) to Apps by increasingly delegating activities from VBA to be executed by the Execution API in Apps Script, while continuing to orchestrate the process from Office until the migration is complete.
There is no official Google library for VBA, but these examples use the Execution REST API to create an access class with a simple interface for VBA projects.
Here’s how the Execution API can enable VBA to Apps Script migration. There are examples and walkthroughs as well as VBA and Apps Script code samples.
All code samples can be found on Github. Note that that VBA samples have been developed for Office for Windows and may need some tweaking for Office for Mac.
- Incremental migration – the steps involved in moving workload from Office to Apps in manageable chunks.
- VBA and Apps Script inventory – what’s needed, and examples of orchestrating the Execution API from VBA.
- Authentication and access – how to authenticate to and access the Execution API from VBA.
- Reading and writing Sheets from VBA – manipulate sheet data directly from VBA.
- Migrating logic – delegating logic tasks to Apps Script from VBA.
- Migrating orchestration – the migration is almost complete. Move the orchestration tasks to Apps Script.
- Final migration steps – In most cases the Office workflow can be retired. However there are cases when legacy dependencies still need to be maintained for some period.