Skip to content

Exporting Data to Google Sheets

How to setup Google Sheets to work with Fluentos integrations.

Direct Export using Google App

  • Open your Google Sheet.
  • Go to Extensions > Apps Script.
  • Replace the default code with the following code:
function doPost(e) {
try {
// Parse the POST request data
var data = JSON.parse(e.postData.contents)
// Get the active sheet
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
// Create an array to hold row data
var rowData = []
// Loop through the received data
for (var key in data) {
if (data.hasOwnProperty(key)) {
var value = data[key]
// Check if the value is an array
if (Array.isArray(value)) {
// Push each item in the array as a separate column
rowData = rowData.concat(value)
} else {
// If the value is a string or number, push it as-is
rowData.push(value)
}
}
}
// Append the row to the sheet
sheet.appendRow(rowData)
// Return success message
return ContentService.createTextOutput(
JSON.stringify({ status: 'success', message: 'Data added successfully' }),
).setMimeType(ContentService.MimeType.JSON)
} catch (error) {
// Handle any errors
return ContentService.createTextOutput(
JSON.stringify({ status: 'error', message: error.toString() }),
).setMimeType(ContentService.MimeType.JSON)
}
}
  • Save your project and then click on Deploy > Manage Deployments.
  • Click Create Deployment.
  • Click on Select type > Web app.
  • Select Anyone in the Who has access dropdown (this allows external requests).
  • Click Deploy.
  • Click Authorize access and click Allow.

You will get a URL for your web app. This URL will be the endpoint you make a POST request to.

  • Click Copy Web app URL (save it for later).

It should look similar to this:

https://script.google.com/macros/s/AKfycbxLBz3OlJH5MqeGVlCECtdeRBqKUAJUZ1qwhq1jGdXQ9jhi0rUXZKBHpjSxgNeiLbK1/exec

Creating Integration In Fluentos

  • Navigate to the Fluentos Dashboard https://app.fluentos.com.
  • On the left side, click on Integrations.
  • Click Add new integration in the top right corner.
  • Enter Integration name > Google Sheets or anything else you preffer.
  • Select Integration > Custom.
  • Check Enabled.
  • Select Method > Post.
  • Enter Endpoint URL > Web app URL from Google Sheets you copied.
  • Click Add new Header, then select Header Key > Content-Type and enter application/json into the Assign value field.
  • In the Notification Recipients field, enter your email address to receive notifications in case the integration fails.

It should look similar to this: Fluentos Integration Screen

Connecting Popup With Integration

  • Navigate to the Campaign you want to export the data from.
  • Click on the Publish tab in the top right corner.
  • Select Integrations on the right side.
  • Select Integration > Google Sheets (the integration you created earlier).
  • Enter values in the Integration Field; it can be any string value. Each of these values will appear in Google Sheets.
  • Select Publish and Save. Now, go ahead and test it! Once you submit your data during the test, give it about 30 - 60 seconds for the submitted data to appear in Google Sheets.

It should look similar to this: Fluentos Integration Screen

If you’re having trouble setting it up, feel free to reach out to support.