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

If you are using Formbricks Cloud, you will need to configure this integration differently. Please follow this guide here to set it up.

Setup

Integrating Google Sheets with a self-hosted Formbricks instance requires configuring Google Cloud and updating your environment variables.

If your Google Cloud Console project has a publishing status of “Testing” your refresh token will expire after 7 days. To avoid that, you need to change the publishing status to “Production”. Google OAuth 2.0 documentation

  • Go to the Google Cloud Console and create a new project.

  • Enable necessary APIs:

    • Now select the project you just created and go to the APIs & Services section.

    • Click on the Enable APIs and Services button and search for Google Sheets API and enable it.

  • Configure OAuth Consent Screen:

    • Go to OAuth Consent screen and select the appropriate User Type (External or Internal). Select Internal if you want only the users of your Google Workspace to be able to use the integration.

    • Fill the required details:

      • App name: Name displayed during OAuth authentication.

      • User support email and Developer contact information: Your contact details for support.

    • Click on Save and Continue.

  • Add required Scopes:

  • Click on the Add or Remove Scopes button and add the scopes:

  • Click on the Update button. Verify the scopes and click on the Save and Continue button.

  • Skip the Test Users section and click on the Save and Continue button.

  • View the OAuth Consent Screen summary and click on the Back to Dashboard button.

  • Register OAuth Client:

  • Navigate to Credentials > Create Credentials > OAuth Client ID.

  • Select Web Application and set:

    • Name: Name of the OAuth Client ID.

    • Authorized JavaScript Origins: https://<your-public-facing-url>

    • Authorized redirect URIs: https://<your-public-facing-url>/api/google-sheet/callback

  • Save and note the Client ID and Client Secret.

  • Copy the Client ID and Client Secret and set them as environment variables in your Formbricks instance:

    • GOOGLE_SHEETS_CLIENT_ID

    • GOOGLE_SHEETS_CLIENT_SECRET

    • GOOGLE_SHEETS_REDIRECT_URL

Now just copy GOOGLE_SHEETS_CLIENT_ID, GOOGLE_SHEETS_CLIENT_SECRET and GOOGLE_SHEETS_REDIRECT_URL for your integration & add it to your Formbricks environment variables as in the docker compose file:

  • 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 Google Sheets Integration with Formbricks section to link a Google Sheet with Formbricks.

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