
In this tutorial, we will learn how to use a free Google Apps Script (GAS) platform for automation. We will configure App Script to add a row with SpreadSimple order info to a separate Google Sheet.
When a user makes an order, the order details will be posted to a configured webhook URL. In our case, that destination will be an App Script published as Web App. The App Script function will format the order information and add it as a row to the associated Google Sheet document. All of this will happen in the background and will not affect the user experience.
The Google Sheet where the orders will be collected will be bonded to the App Script. This is not necessarily the same sheet where information about the goods is stored, and moreover, I encourage you to create a separate Sheet. Let’s create one and add the columns that should be self-explanatory:

Under the Tools menu open the Script editor

You will be redirected to the editor of a newly created script:

You can click on the title to give it the name.
Now instead of the default myFunction () {...} paste this code:
function doPost(e) {
const order = JSON.parse(e.postData.contents)
const orderRow = [
new Date(),
order.orderId,
order.client.name,
order.client.email,
order.client.phone,
order.client.message,
order.totalAmount,
order.cartItemsText
]
SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().appendRow(orderRow)
return ContentService.createTextOutput('OK')
}
And don’t forget to hit the Save button.

This function is essentially handling the POST request (which will be triggered by our webhook a bit later), and does the following:
Hit the Deploy button and select New deployment:

Then select the Web app as the type of deployment:

Change the ‘Who has access’ dropdown value to ‘Anyone’ and hit ‘Deploy’

Then click the Authorize access button -> Click on your Account name -> Click on ‘Advanced’ link and finally click the ‘Go to… ’ link

Don’t worry about ‘(unsafe)’ part, it’s you granting access to your spreadsheet. You can read about Authorization for Google Services if you’d like to learn more.And finally copy the Web app URL

Go back to your SpreadSimple Dashboard and open the Checkout Tab, then under the Webhooks section paste your Web App URL:

Hit Save, then hit Publish.
Now we can see it in action: each order will be stored as a separate row in your orders spreadsheet:
Despite the fact this automation option may seem difficult to some, it brings many advantages:
And finally some inspiration on what else can be achieved:
P.S. https://gist.github.com/spreadsimple/0f2a73a2f8e93c46ab39b69bb49d612f
For additional or custom fields you should use formFields instead of order property in the webhook's payload object. That means you can access the address field value by order.formFields.address.

