Tuesday, June 28, 2011

How to add a dropdown (list) box in Google Spreadsheet

I wanted a dropdown box in my google spreadsheet document and soon I realized dropdown control was not supported in google spreadsheet. But, I found a workaround solution to add the dropdown in google spreadsheet. Here are the steps:

1)
Add the entries for the dropdown in a column in worksheet. I wanted a dropdown which lists all the months for the current year. I created a separate worksheet called "Config" and entered all the months in "Month" column. This column will act as a dropdown control for us.

2)
Now in the target worksheet, I have a month column and wanted a feature to be able to pick a month from the dropdown. This is how I got my month column in the target worksheet working:
- Select the column for which you want the dropdown to show up for each cell in the column
- Select "Data->Validation" from the Google Docs menu
- In the "Cell Range" section, you should see the cell range for the column you selected (target column)
- From the "Criteria" dropdown select "Item from a list" entry
- Select "Create a list from range" radio button and the range section next to the radio button enter the cell range for the dropdown list (source). In my case I had the entries for the month dropdown in a separate worksheet and the cell range was like this: "Config!B2:B13"
- Leave other default settings as it is and save the data validation

3)
Now go to your target column and select one of the cell. You should see the dropdown list at the right side of the cell.