This article is only applicable for MachForm Self-Hosted. If you're using MachForm Cloud, you can skip this.

To integrate Google Sheets with your forms, you’ll need to create your Google Client ID and Client Secret and save it within your MachForm settings page.

This setup is only needed once and should be completed by the main administrator of your MachForm account. It’s quite lengthy steps, unfortunately, but Google requires this, so a bit of patience is required :-)

This setup only needed for MachForm Self-Hosted. If you’re using MachForm Cloud, you don’t need to do any of this setup, since we’ve done it from our side.

Here are step-by-step instructions to create your Google Client ID and Client Secret:

1. Login to your Google account and go to the Google API Console page.

2. Click the Projects menu on the top and then click the New Project button

3. Give your project a name (any name is fine)

4. Once you’ve created your project, make sure to select your project and click Enable APIs and Services.

5. Search for Google Sheets API and click on the result.

6. Click the Enable button

7. Select Credentials under the API Console dashboard page

8. Click the Configure Consent Screen button

9. You'll be prompted to choose the User Type. If you're using G Suite account, choose Internal, otherwise choose External. In this guide, we're choosing the External user type.

10. Fill all the information required by Google and complete the whole app registration form. Make sure you've added your authorized domain within the app registration form as well.

11. Once you've completed the first page, go to the next page and click Add or Remove Scopes button.

12. Choose Google Sheets API.

13. Add test users. You can use these users to test your integration before going live.

14. Complete the form, go to the dashboard and click the Credentials -> Create Credentials -> OAuth Client ID button.

15. Choose "web application" as the application type and provide a name.

16. Click the ADD URI button under the Authorized redirect URIs section.

17. Fill the Authorized Redirect URIs with the URL provided from your MachForm and click the Create button.

The URL should be something like:
http://www.yourdomain.com/machform/oauth_callback_google.php

18. On the page that appears, copy the Client ID and Client Secret to your clipboard.

19. Login to your MachForm Panel, go to Settings page and click advanced options under Miscellaneous Settings. Then paste your Client ID and Client Secret.

Save the Settings page and you've successfully completed the setup!