The Google Sheets integration allows you to automatically send responses to a Google Sheet of your choice.
- Go to the Integrations tab in your Formbricks Cloud dashboard and click on the "Connect" button under Google Sheets integration.
- Now click on the "Connect with Google" button to authenticate yourself with Google.
You will now be taken to the Google OAuth page where you can select the Google account you want to use for the integration.
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:
- Now click on the "Link New Sheet" button to link a new Google Sheet with Formbricks and a modal will open up.
- 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.
- On submitting, the modal will close and you will see the linked Google Sheet in the 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.
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.
- Go to the Google Cloud Console and create a new project.
- 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.
- 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.
- 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)
- Now click on the "Save and Continue" button and you will be taken to the Scopes step.
- Click on the "Add or Remove Scopes" button and add the scopes
https://www.googleapis.com/auth/driveand click on the "Update" button:
- Now Verify the scopes and click on the "Save and Continue" button.
- Now go to the "Test Users" section, skip the step, and click the "Save and Continue" button.
- You will now be shown a summary of the OAuth Consent Screen. Verify the details and Click on the "Back to Dashboard" button.
- Now go to the "Credentials" section and click on the "Create Credentials" button and select "OAuth Client ID".
- Select "Web Application" as the Application Type and provide it a name (this name will not be visible to your end users).
- Now add the following URL in the "Authorized redirect URIs" section and click on the "Create" button:
- 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
- Also use the same Authorized redirect URI in the
By now, your environment variables should include the below ones as well:
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.
To remove the integration with Google Account,
- Visit the Integrations tab in your Formbricks Cloud dashboard.
- Select "Manage" button in the Google Sheets card.
- Click on the "Connected with
<your-email-here>" just before the "Link new Sheet" button.
- 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.
- 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:
- User Email: To identify you (that's it, nothing else, we're opensource, see this in our codebase here)
- Google Drive API: To list all your google sheets (that's it, nothing else, we're opensource, see this method in our codebase here)
- 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!