Integrations

Google Sheets

The Google Sheets integration allows you to automatically send responses to a Google Sheet of your choice.

Formbricks Cloud

  1. Go to the Integrations tab in your Formbricks Cloud dashboard and click on the "Connect" button under Google Sheets integration.
Formbricks Integrations Tab
  1. Now click on the "Connect with Google" button to authenticate yourself with Google.
Connect Formbricks with your Google
  1. You will now be taken to the Google OAuth page where you can select the Google account you want to use for the integration.

  2. Once you have selected the account and completed the authentication process, you will be taken back to Formbricks Cloud and see the connected status as below:

Formbricks is now connected with Google
  1. Now click on the "Link New Sheet" button to link a new Google Sheet with Formbricks and a modal will open up.
Link Formbricks with a Google Sheet
  1. Select the Google Sheet you want to link with Formbricks and the Survey. On doing so, you will be asked with what questions' responses you want to feed in the Google Sheet. Select the questions and click on the "Link Sheet" button.
Select question to link with Google Sheet
  1. On submitting, the modal will close and you will see the linked Google Sheet in the list of linked Google Sheets.
List of linked Google Sheets

Congratulations! You have successfully linked a Google Sheet with Formbricks. Now whenever a response is submitted for the linked Survey, it will be automatically added to the linked Google Sheet.

Setup in self-hosted Formbricks

Enabling the Google Sheets Integration in a self-hosted environment isn't easy and requires a setup using Google Cloud and changing the environment variables of your Formbricks instance.

We will first create a Google Cloud Project and then enable the Google Sheets API for it. Then we will create an OAuth Client ID and Client Secret for our Formbricks instance and set them as environment variables.

  1. Go to the Google Cloud Console and create a new project.
  2. Now select the project you just created and go to the "APIs & Services" section.
  3. Click on the "Enable APIs and Services" button and search for "Google Sheets API" and enable it.
  4. Now go to the "OAuth Consent screen" section and select the "External" User Type if you want any Google User to be able to use the integration or select "Internal" if you want only the users of your Google Workspace to be able to use the integration.
  5. Now provide it the details such as
    • App name (Will show up in the OAuth modal when the user is asked to authenticate with Google)
    • User support email (ideally should be your email for any support queries by the Users or Google)
    • Developer contact information (ideally should be your email for any support queries by Google)
  6. Now click on the "Save and Continue" button and you will be taken to the Scopes step.
  7. Click on the "Add or Remove Scopes" button and add the scopes https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/spreadsheets & https://www.googleapis.com/auth/drive and click on the "Update" button:
  8. Now Verify the scopes and click on the "Save and Continue" button.
  9. Now go to the "Test Users" section, skip the step, and click the "Save and Continue" button.
  10. You will now be shown a summary of the OAuth Consent Screen. Verify the details and Click on the "Back to Dashboard" button.
  11. Now go to the "Credentials" section and click on the "Create Credentials" button and select "OAuth Client ID".
  12. Select "Web Application" as the Application Type and provide it a name (this name will not be visible to your end users).
  13. Now add your public facing URL in the "Authorized JavaScript Origins" section:
    • https://<your-public-facing-url>
  14. Now add the following URL in the "Authorized redirect URIs" section and click on the "Create" button:
    • https://<your-public-facing-url>/api/google-sheet/callback
  15. You will now be shown the Client ID and Client Secret. Copy them and set them as the environment variables in your Formbricks instance as:
    • GOOGLE_SHEETS_CLIENT_ID - Client ID
    • GOOGLE_SHEETS_CLIENT_SECRET - Client Secret
  16. Also use the same Authorized redirect URI in the GOOGLE_SHEETS_REDIRECT_URL environment variable.
  17. One last that we need to do is to enable the Google Drive API for the project. For that, go to the "APIs & Services" section and click on the "Enable APIs and Services" button and search for "Google Drive API" and enable it.

By now, your environment variables should include the below ones as well:

  • GOOGLE_SHEETS_CLIENT_ID
  • GOOGLE_SHEETS_CLIENT_SECRET
  • GOOGLE_SHEETS_REDIRECT_URL

Voila! You have successfully enabled the Google Sheets integration in your self-hosted Formbricks instance. Now you can follow the steps mentioned in the Formbricks Cloud section to link a Google Sheet with Formbricks.

Remove Integration with Google Account

To remove the integration with Google Account,

  1. Visit the Integrations tab in your Formbricks Cloud dashboard.
  2. Select "Manage Sheets" button in the Google Sheets card.
  3. Click on the "Delete Integration" button.
  4. It will now ask for a confirmation to remove the integration. Click on the "Delete" button to remove the integration. You can always come back and connect again with the same Google Account.
Delete Google Integration with Formbricks

What data do you need?

  • Your Email ID for authentication (We use this to identify you)
  • Your Google Sheets Names and IDs (We fetch this to list and show you the options of choosing a sheet to integrate with)
  • Write access to selected Google Sheet (The google sheet you choose to integrate it with, we write survey responses to it)

For the above, we ask for:

  1. User Email: To identify you (that's it, nothing else, we're opensource, see this in our codebase here)
  2. Google Drive API: To list all your google sheets (that's it, nothing else, we're opensource, see this method in our codebase here)
  3. Google Spreadsheet API: To write to the spreadsheet you select (that's it, nothing else, we're opensource, see this method in our codebase here)

Still struggling or something not working as expected? Join our Discord! and we'd be glad to assist you!

Was this page helpful?