How to prefill Zoho Forms with data from Google Sheets using webhooks

How to prefill Zoho Forms with data from Google Sheets using webhooks

Zoho Forms allows you to dynamically prefill form fields with data fetched from external sources. One popular use case is pulling customer data stored in a Google Sheet and pre-populating your forms when the user opens them. This saves time, reduces errors, and improves the user experience.

In this article, we’ll walk you through the step-by-step process of setting up a Google Sheets Apps Script, deploying it as a web app, and integrating it with Zoho Forms via Dynamic Prefill Webhooks.

Check out a quick video on how to configure this.


  1. Open the Google Sheet where your data is stored.


  2. From the top menu, click:
    Extensions → Apps Script.


  3. This will open the Apps Script editor in a new tab.

  4. Copy and paste the following script:

    function doGet(e) {

      const sheetId = "{sheet_id}"; // <-- Replace with your real sheet ID 

      const sheetName = "Sheet1"; // <-- Replace with your real sheet Name 

      const columnToSearch = 1; // e.g., Column B = 2

      const query = e.parameter.query; // Example: ?query=Doe

      if (!query) {

        return HtmlService.createHtmlOutput("Missing query");

      }

      const sheet = SpreadsheetApp.openById(sheetId).getSheetByName(sheetName);

      const range = sheet.getRange(2, columnToSearch, sheet.getLastRow() - 1, 1);

      const finder = range.createTextFinder(query)

        .matchEntireCell(true)   // Exact match

        .matchCase(false);       // Case-insensitive

      const match = finder.findNext(); // FIRST MATCH ONLY

      if (!match) {

        return HtmlService.createHtmlOutput("No matching row found");

      }

      const row = match.getRow();

      const data = sheet.getRange(row, 1, 1, sheet.getLastColumn()).getValues()[0];

      return ContentService.createTextOutput(

        JSON.stringify({

          row: row,

          data: data

        })

      ).setMimeType(ContentService.MimeType.JSON);


    }

  5. Copy the sheetId from your Google Sheet URL as shown.

  6. Replace the sheetId from your Google Sheet URL.



  7. Replace the name of the sheet as shown with the sheet name.

  8. Replace the column where your unique identifier (e.g., email, ID) is stored. Use numbers:
    For example, if you want to search by email stored in column B, set: const columnToSearch = 2;


  9. In the Apps Script editor, click the Deploy button in the top-right corner and select New deployment.


  10. Under Select type, choose Web app.


  11. Fill out the details:

    • Description: Enter something like Fetch data API.

    • Execute as: Me (your account).

    • Who has access: Anyone.


  12. Click Deploy.

  13. The first time you deploy, Google will ask for permissions. Click Authorize.


  14. After deployment, Google will provide you with a Web App URL.


  15. You can test the script in your browser with a value from your sheet’s search column.


  16. It  will return a JSON response containing that row’s data.


  17. Open your form builder in Zoho Forms. Go to Prefill section and add a Prefill-Webhook field. 

  18. Under Webhook Settings, select Employee ID as the Search Field. Make sure the field you select here matches the column you set as columnToSearch in your Google Script.

  19. Under Webhook URL, paste the Web App URL you copied.

  20. Enter the URL Parameter as query. Click Next.



  21. Test the webhook with search field value like 1002 and check if the received response is valid.



  22. Map the fields from your sheet’s response to the corresponding form fields.



  23. Click Save.

Now, when a respondent opens the form, enters their Employee ID and clicks the search icon, the form will call the Google Sheet, fetch details, and prefill the form automatically.



        Create. Review. Publish.

        Write, edit, collaborate on, and publish documents to different content management platforms.

        Get Started Now


          Access your files securely from anywhere

            Zoho CRM Training Programs

            Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

            Zoho CRM Training
              Redefine the way you work
              with Zoho Workplace

                Zoho DataPrep Personalized Demo

                If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

                Zoho CRM Training

                  Create, share, and deliver

                  beautiful slides from anywhere.

                  Get Started Now


                    Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                    BOOK A SESSION







                                Quick LinksWorkflow AutomationData Collection
                                Web FormsEnterpriseOnline Data Collection Tool
                                Embeddable FormsBankingBegin Data Collection
                                Interactive FormsWorkplaceData Collection App
                                CRM FormsCustomer ServiceAccessible Forms
                                Digital FormsMarketingForms for Small Business
                                HTML FormsEducationForms for Enterprise
                                Contact FormsE-commerceForms for any business
                                Lead Generation FormsHealthcareForms for Startups
                                Wordpress FormsCustomer onboardingForms for Small Business
                                No Code FormsConstructionRSVP tool for holidays
                                Free FormsTravelFeatures for Order Forms
                                Prefill FormsNon-Profit

                                Intake FormsLegal
                                Mobile App
                                Form DesignerHR
                                Mobile Forms
                                Card FormsFoodOffline Forms
                                Assign FormsPhotographyMobile Forms Features
                                Translate FormsReal EstateKiosk in Mobile Forms
                                Electronic Forms
                                Drag & drop form builder

                                Notification Emails for FormsAlternativesSecurity & Compliance
                                Holiday FormsGoogle Forms alternative GDPR
                                Form to PDFJotform alternativeHIPAA Forms
                                Email FormsFormstack alternativeEncrypted Forms

                                Wufoo alternativeSecure Forms

                                TypeformWCAG

                                  Zoho FSM Video Tutorials


                                        All-in-one knowledge management and training platform for your employees and customers.

                                                  Create. Review. Publish.

                                                  Write, edit, collaborate on, and publish documents to different content management platforms.

                                                  Get Started Now




                                                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                        Manage your brands on social media


                                                                          • Desk Community Learning Series


                                                                          • Digest


                                                                          • Functions


                                                                          • Meetups


                                                                          • Kbase


                                                                          • Resources


                                                                          • Glossary


                                                                          • Desk Marketplace


                                                                          • MVP Corner


                                                                          • Word of the Day


                                                                          • Ask the Experts


                                                                            Zoho Sheet Resources

                                                                             

                                                                                Zoho Forms Resources


                                                                                  Secure your business
                                                                                  communication with Zoho Mail


                                                                                  Mail on the move with
                                                                                  Zoho Mail mobile application

                                                                                    Stay on top of your schedule
                                                                                    at all times


                                                                                    Carry your calendar with you
                                                                                    Anytime, anywhere




                                                                                          Zoho Sign Resources

                                                                                            Sign, Paperless!

                                                                                            Sign and send business documents on the go!

                                                                                            Get Started Now




                                                                                                    Zoho TeamInbox Resources





                                                                                                              Zoho DataPrep Demo

                                                                                                              Get a personalized demo or POC

                                                                                                              REGISTER NOW


                                                                                                                Design. Discuss. Deliver.

                                                                                                                Create visually engaging stories with Zoho Show.

                                                                                                                Get Started Now








                                                                                                                                    • Related Articles

                                                                                                                                    • Google Sheets Integration

                                                                                                                                      Overview If you are looking to automate storing your form responses in a sheet and save the time spent on manual entry of form data into the sheet, you can use the Zoho Forms - Google Sheets integration. With this integration, your form responses ...
                                                                                                                                    • Welcome to Zoho Forms!

                                                                                                                                      Transform the time-consuming “ collect, stack, and enter ” paper form workflow into “ capture, store, and process ” paperless approach with Zoho Forms and simplify data collection. Who is Zoho Forms for? Zoho Forms is for anyone who wants to ...
                                                                                                                                    • Field Alias - Prefill URL

                                                                                                                                      Table of contents What is prefilling form fields? Why is prefilling forms important? What is Field Alias? Set Field Alias Generate a prefilled form URL Manually create the URL of a prefilled form Prefill a Multiple Choice Field Prefill a Dropdown ...
                                                                                                                                    • Tracking using Google Analytics

                                                                                                                                      If you are using Google Analytics to track your campaign goals, you can track each completed form submission as a goal by configuring Destination Goals. Universal Analytics If you are using the Universal Analytics property in Google Analytics, follow ...
                                                                                                                                    • How to prefill Zoho Forms with data from Zoho Sheet using webhooks

                                                                                                                                      Zoho Forms allows you to dynamically prefill form fields with data fetched from external sources. One popular use case is pulling customer data stored in a Zoho Sheet and pre-populating your forms when the user opens them. This feature is especially ...
                                                                                                                                      Wherever you are is as good as
                                                                                                                                      your workplace

                                                                                                                                        Resources

                                                                                                                                        Videos

                                                                                                                                        Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                        eBooks

                                                                                                                                        Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                        Webinars

                                                                                                                                        Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                        CRM Tips

                                                                                                                                        Make the most of Zoho CRM with these useful tips.



                                                                                                                                          Zoho Show Resources