This sample was created for a talk for Google Cloud NEXT'18 entitled "Building on the Docs Editors: APIs and Apps Script". It is an implementation of a Google Sheets add-on that:
- Authenticates with Salesforce via OAuth2, using the Apps Script OAuth2 library.
- Runs SOQL queries against Salesforce and outputs the results into a new sheet
- Creates invoices in Google Docs and a sample presentation in Google Slides using the imported data.
- Install clasp
- Run
clasp create <script name>
to create a new script - Follow Salesforce's instructions
to sign up as a developer and create an OAuth2 application
- Set your callback URL to
https://script.google.com/macros/d/{SCRIPT ID}/usercallback
where{SCRIPT ID}
is taken from the URL outputted byclasp create
.
- Set your callback URL to
- Update
Constants.gs
with your Salesforce client ID and client secret - Run
clasp push
to upload the contents of this folder to Apps Script - Run
clasp open
to open the project in the Apps Script IDE - Follow the Test as Add-on
instructions to run the add-on in a spreadsheet
- On your test spreadsheet's menu, visit Add-ons -> <script name> -> Login to Salesforce to sign in to Salesforce.