Data Sources: Google Sheets

The Google Sheets add-on includes a data source that can be used to feed sheet data into Select, Checkbox and Radio fields.

An example use case for this feature would be populating the options shown in a select field from a sheet in Google Sheets. When the sheet rows are changed, the options in your field will also change automatically and are kept synchronized on you WordPress form.

WS Form - Data Sources - Google Sheets

Creating a Google Sheet

The setup of a Google Sheet for use with a WS Form data source is very simple. The first row contains the column headings and the rest of the rows below that contain the data. An example sheet would look as follows:

Value Label
option1 Option 1
option2 Option 2
option3 Option 3
option4 Option 4
option5 Option 5
option6 Option 6

There is no strict layout requirement other than the first row being headings. The WS Form column mapping system allows you to use virtually any sheet layout.

Creating a Google Sheets Data Source

To create a Google Sheets data source for a Select, Checkbox or Radio field:

  1. Edit the field.
  2. For a Select field, click the Options tab. For a Checkbox field, click the Checkboxes tab. For a Radio field, click the Radios tab.
  3. Choose Google Sheets from the Data Source setting.
  4. Choose the file you want to load data from in the File setting.
  5. Choose the sheet you want to load data from in the Sheet setting.
  6. The update frequency determines how often WS Form should retrieve the data from the source. This defaults to Once Hourly but you can change this to Real-Time or a different increment of time. When previewing a form, real-time data is always used.
  7. Click Get Data to do a test retrieval of the data from the sheet. The data will then appear below in a data grid.

WS Form - Data Sources - Google Sheets - Settings

Column Mapping

Column mapping allows you to map different columns of your data grid to different parts of your field.

In the example above we would want to map the Value column to the Values mapping and the Label column to the Labels and Action Variables mapping.

WS Form - Data Sources - Google Sheets - Column Mapping

Setting Row Attributes

Depending on the field type, the following heading labels can be used to set row attributes:

Heading Attribute Field Types Example
wsf_default Default Select, Checkbox, Radio For a Select field, the option would be selected
wsf_required Required Checkbox, Radio For a Checkbox field, the checkbox would be required
wsf_disabled Disabled Select, Checkbox, Radio For a Select field, the option would disabled
wsf_hidden Hidden Select, Checkbox, Radio For a Select field, the option would be excluded

An example Google Sheet using these headings for a Select field would be:

Value Label wsf_default wsf_disabled
option1 Option 1 Yes
option2 Option 2
option3 Option 3 Yes
option4 Option 4
option5 Option 5
option6 Option 6

To enable an attribute you can use any of these cell values:

  • Yes / yes
  • On / on
  • True / true
  • 1