Introduction
A multi-select dropdown is a valuable tool that allows users to efficiently choose multiple options from a list. In this tutorial, we’ll explore how to create a custom multi-select dropdown in Google Sheets using Apps Script and HTML. By the end of this guide, you’ll have a functional multi-select dropdown that you can use to capture multiple selections within your Google Sheets.

Prerequisites
- Basic familiarity with Google Sheets and its Script Editor.
- A Google account to create a new Google Sheets project.
Setting Up the Development Environment
Open Google Sheets and create a new spreadsheet where we’ll build our multi-select dropdown.
Navigate to “Extensions” in the top menu, then click on “Apps Script” to open the Script Editor.
In the Script Editor, create a new project by clicking on “File” > “New” > “Script file.” Name the new script file as “Code.gs.”
Create one more script file: “dialog.html.” You can do this by clicking on “File” > “New” > “HTML file”.
Understanding the Code
Let’s briefly go through the purpose of each code file:
Code.gs: This file contains the Apps Script code that manages the dialog popup, stores selected options, and retrieves checkbox options.
dialog.html: This file contains the HTML and JavaScript code that creates the visual interface for the multi-select dropdown.
Building the Multi-Select Dropdown Interface
In the “dialog.html” file, we create a simple HTML form that dynamically generates checkboxes based on the options we provide. We’ve used Bootstrap to enhance the appearance of the dropdown, but you can customize the styling according to your preference.
Dynamically Generating Checkbox Options
In the “Code.gs” file, we define the getCheckboxOptions()
function, which returns the options for the multi-select dropdown as an array. This array is then passed to the HTML file, where the checkboxes are dynamically generated using JavaScript.
Submitting and Storing Selected Options
In the “Code.gs” file, we define the submitForm()
function, which is triggered when the user clicks the “Submit” button in the HTML dialog. This function collects the selected checkbox values and stores them in the active cell of the Google Sheets.
Entire script in Code.gs module
In the “Code.gs” file, we define the submitForm()
function, which is triggered when the user clicks the “Submit” button in the HTML dialog. This function collects the selected checkbox values and stores them in the active cell of the Google Sheets.
Triggering the Multi-Select Dropdown
To use the multi-select dropdown, add a button on the sheet and assign ‘showDialog‘ function to the button.
click the button to open the dialog containing the multi-select dropdown, and you can select multiple options. Click here to get the copy of the sheet with source code.