Templates / Export Salesforce query to existing Google Sheet
Export Salesforce query to existing Google Sheet
This template allows you to take a small set of Salesforce records (maximum being 2,000), and update a Google Sheet that you are using for a report.
The resulting workflow can then be set to a schedule and will refresh the worksheet tab with an updated set of records as desired.
You could potentially expend this template by building new/ more worksheets within the spreadsheet to make reports and graphs from. Or once updated, use it to automatically generate weekly/ monthly/ etc scheduled reports for specific information.
The following connectors are used in this template. This is provided for reference only - there is no need to read through the linked connector pages, as all you need to know for this template is explained here:
The image below shows the Salesforce queried data put into a Google spreadsheet.
Any pre-existing workbook data in the spreadsheet will have been wiped clean.
Ther is also an email notification sent to the user.
This workflow assumes the following:
You already have authentications with Salesforce and Google Sheets.
You have a Google Sheet with a spreadsheet tab, relevant column headers, and actual rows in it. Please see Important notes: Zero rows below.
You only wish to pull records from a single SFDC object type
The complete workflow looks like this:
It uses a manual trigger. Remember you could change this to a Scheduled Trigger if desired.
There are 4 basic steps in the workflow:
Stage 1 takes your Salesforce query and collects your record type, desired fields and conditions of you provide any.
Stage 2 deletes the data currently in the Worksheet. This cleans the report each time it is run.
Stage 3 loops through the SFDC records collected and appends a line to the Worksheet for each record found. Adding information to the relevant column.
Stage 4 sends an email reminder to the user to tell them their report is ready/updated.
In order to configure this workflow for use, simply:
Do not start with an empty spreadsheet. This will cause your template to error.
That is to say, a spreadsheet that has zero rows or only the header row available.
The spreadsheet tab you are using must have some rows in it before you begin.