Skip to content

Why is the webflow form data not showing in google sheets?

I’ve been using these codes to get data parsed from a webflow form into a google sheets, but this time, this is not working and I can’t find out why, since there’s no apparent error.

This is script embedded in the webflow site build:

const scriptURL = ''
const form = document.forms['wf-form-Contato-Form']
  form.addEventListener('submit', e => {
      { method: 'POST', body: new FormData(form), mode: 'no-cors'}
      .then(response => console.log('Success!', response))
      .catch(error => console.error('Error!', error.message))

This is the piece sitting in the Google Apps Script environment:

var sheetName = 'Leads'
var scriptProp = PropertiesService.getScriptProperties()

function intialSetup() {
  var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet()
  scriptProp.setProperty('key', activeSpreadsheet.getId())

function doPost(e) {
  var lock = LockService.getScriptLock()

  try {
    var doc = SpreadsheetApp.openById(scriptProp.getProperty('key'))
    var sheet = doc.getSheetByName(sheetName)

    var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0]
    var nextRow = sheet.getLastRow() + 1

    var newRow = (header) {
      return header === 'Data' ? new Date() : e.parameter[header]

    sheet.getRange(nextRow, 1, 1, newRow.length).setValues([newRow]);
    return ContentService
      .createTextOutput(JSON.stringify({ 'result': 'success', 'row': nextRow }))
  catch (e) {
    return ContentService
      .createTextOutput(JSON.stringify({ 'result': 'error', 'error': e }))
  finally {

When the form is submitted, the network console session only shows the fields filled in, ignoring the empty ones. Not sure of headers function above requires all fields to come from the form, so that they can be mapped…

enter image description here

And the script gets executed at the apps script end with no apparent error, but nothing shows up in the sheets.

Appreciate any light towards to the reason.


Add some console.log statements to you Apps Script in order to help you to debug it.


The above statement will log the web app event object.

console.log(`${sheetName} `${(!sheet ? '' : 'does't'} exists`);

The above statement could be useful to be sure that the required sheet exists.