Sync chained selects with a Google Drive sheet

Posted by:

You are here:
← All Topics

Using chained select is a great way to convert an Excel file into a series of dropdowns that change depending on the user’s selections. Not sure what I mean? Check this video that explains it better than me.

This approach requires an Excel (or CSV) file you upload when designing the form. But with the Google Sheets add-on, you can go one step further and use a Google sheet instead. And the best part is that you can even configure the field to be automatically updated when the Sheet is modified!

To link a chained select to Google Drive follow these steps:

1.- Configure the Google sheet add-on as explained in steps 1-3 of this tutorial:

2.- Add a chained select field in your form and in the ‘Source’ setting Select ‘Google Sheet’

3.- Select a google sheet file and a google sheet tab(this will list all the Google sheets you had shared as explained in the tutorial of step 1)

And that’s it! Now the chained select will create the dropdowns using the selected Google sheet.

Sync your Google Sheet with your chained select automatically

If you want your chained select to be updated every time your Google sheet is modified, follow these steps:

1.- Check “Sync automatically”

2.- Click on “View trigger code” and copy the displayed code.

Important: Google needs to be able to contact your site and notify that an update is available. This means that you might need to do some additional network configuration to make it work in a localhost or vpn site.

3.- Open your Google sheet and go to Extensions/Apps Script

4.- A new window will be open. Replace the default code with the code that you copy in step 2.

5.- Click on save project

6.- In the left menu, click on triggers

7.- Click on “Add Trigger”.

8.- In the popup make sure the “Choose which function to run” is set to “atEdit” and the “Select event type” is set to “On edit”. Then click on save.

That’s it! Now the chained select will be changed when the Google sheet is updated.


About the Author:

Im programmer working for an international company. I have programmed since i was 12 and i have done it professionally for 6 years. Programming for a company is fun and i have learned a lot of things but i have always been interested in running my own business so i decided to give it a shot doing what i do best, programming stuffs.
  Related Posts
  • No related posts found.