Google Apps Script that appends a JSON object to a Google Sheets spreadsheet as columns, suitable for use as a formsort webhook integration.
Also allows setting a Slack webhook to be pinged when receiving a result.
- runs entirely within your Google Apps domain
- automatically creates new columns if new data fields appear in the JSON body
- always adds a
received_atcolumn to mark when data was received by the script
- Make a new Google Sheet you want to use for your answers. Keep it blank.
- Go to https://script.google.com and create a new script.
- Paste the
Code.gsin this respository into theCode.gsof that project - Update the
SPREADSHEET_URLvariable at the top with the URL of your spreadsheet. If you'd like a slack webhook to be pinged when the webhook is processed, enabled the Incoming Webhooks App on slack and then replace SLACK_URL with the webhook URL. If you're not using one or another, set it tonull; - Debug the script, to ensure it's connected, by clicking
Debugin the toolbar with thetestfunction selected. You should see a row added to the output. - Publish the script, using
Deploy > New deployment, with the following settings:- Type: Web app
- Execute as: Me
- Who has access: Anyone (Don't worry, the URL is unique and only you will have it.)
- Copy the web app URL, which starts with
https://script.google.comand ends with/exec, to Formsort's webhook url in the integrations section. - To test the configuration end-to-end, use the Send test webhook button.
- Deploy any variants in the flow that you'd like to start using this.
- You do not need to update the spreadsheet or script settings when you change the flows - columns will automatically be added or removed as needed.