Skip to content

Google Sheets Integration

Google Sheets setup can be divided into two parts.

  1. Generate Web App URL from Google Sheets
  2. Add the Google Sheets Web App URL to Fluentos

1. Generate Web App URL from Google Sheets

  1. Open your Google Sheet.
  2. Go to Extensions > Apps Script.
  3. 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)) {
rowData.push(value.join(','))
} 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)
}
}
  1. Save your project and then click on Deploy > Manage Deployments.
  2. Click Create Deployment.
  3. Click on Select type > Web app.
  4. Select Anyone in the Who has access dropdown (this allows external requests).
  5. Click Deploy.
  6. Click Authorize access, and click Allow.

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

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

It should look similar to this:

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

2. Add the Web App URL to Fluentos

Navigate to the Integrations page, click the Add New Integration button, and follow these steps:

  1. Enter Integration name > Google Sheets or anything else you prefer.
  2. Select Integration > Custom.
  3. Turn on the Enabled toggle.
  4. Select Method > Post.
  5. Enter Endpoint URL > Web app URL from Google Sheets you generated and copied as explained above.
  6. Click Add New Header, then select Header Key > Content-Type and enter application/json into the Assign value field.
  7. In the Notification Recipients field, enter your email address to receive notifications if the integration fails.

It should look similar to the image shared below:

Add New Integrationn