If you want to collect responses from your widget in Kameleoon and export them to CSV, refer to the Survey data export article.
Configure your Google Sheet
- Go to Google Sheets and create a new spreadsheet.
- Name the tab Sheet1 (which is the default).
-
In the first row, define the columns as follows:
Details:

- Column A: Enter Date. The script fills this cell with the date and time of each submission.
- From column B onward: Enter the name of each survey or form element added to your widget.
When you select an element (for example, a scale), its name appears at the top of the editing sidebar.
Consider this widget as an example:
This widget has two survey elements, so enter the following in the first row of the Google Sheet:
- Column A: Date
- Column B: Scale
- Column C: Long Answer
-
Click Extensions > Apps Script. A new Google Script opens. Rename it. For example, use “form data.”

-
Replace all code with the following:
If you can’t name your tab “Sheet1,” change the value of
sheetNamein the first line of the script to your tab’s actual name.
- Click Save project to Drive (to the left of Run).
-
In the dropdown to the right of Debug, select
initialSetup(usually selected by default). -
Click Run.
You might see a pop-in asking for permissions. Click Review permission and continue to the next screen.
Because Google hasn’t reviewed the script, a warning message may appear. Click Go to form data (unsafe) to grant the permissions that let the script update your spreadsheet.
After you grant the permissions, the console shows Execution completed.


-
In the left menu, click Triggers to add a trigger for the script.

-
Click Add trigger. In the window that appears, select the following options:
- Choose which function to run:
doPost - Choose which deployment should run:
Head - Select event source:
From spreadsheet - Select event type:
On form submit

- Choose which function to run:
- Click Save.
- Click Deploy > New deployment.
-
Click the cog icon next to Select type > Web app. In the form that appears, select the following options:
- Description: Use a descriptive name, such as “form data.”
- Web app > Execute as:
Me - Web app > Who has access:
Anyone
-
Click Deploy.

- Copy the URL.
Configure survey settings in the Widget Studio
- In the Survey Settings tab, turn on Collect survey data.
- Under When is the survey submitted?, select A button is clicked, then choose the button that visitors click to submit.
- Under How are responses collected?, choose Externally (HTTP Request).
- Request name: Name your request. For example, use “send data to Google Sheet.”
- Method: Select
POST. - Action URL: Paste the URL generated by your Google Apps Script.
- Save your configuration.
Test your setup
- Preview your widget.
- Fill out the survey and Submit.
- Go back to your Google Sheet.