Connect with us


Update dropdown options for HTML forms embedded in modal dialogs in Google Sheets after form submission

Update dropdown options for HTML forms embedded in modal dialogs in Google Sheets after form submission


There seem to be a lot of questions about how to achieve this, but I couldn't implement anything that worked in my case.

I have an HTML form in a modal dialog in Google Sheets. This form is used to update the name of the job using textFinder. (These job names are used in multiple spreadsheets within the company and may be concatenated with other values, for example to link jobs and individuals.)

The first field is a dropdown to select the job name to update. The dropdown gets its values ​​from a range in Google Sheets. The second field is a text field for entering the new name. After the form is submitted, all instances of the original job name will be replaced with the new name across multiple spreadsheets, including the original name within the spreadsheet range entered in the form dropdown.

All of these work properly. What I'm stuck on is allowing multiple changes to be made in a row without closing the modal (or letting it close automatically). The dropdown does not update and does not display new values. What I really want to accomplish is to display a confirmation message (instead of the alert I'm using) and update the form. I don't know how to implement that function in the code here. I know it can be done using the withSuccesshandler function, but I couldn't get it to work. Can someone help me with this?

The applicable code is:


function onOpen() { var ui = SpreadsheetApp.getUi(); ui.createMenu('Manager Menu') .addItem('Update Job Name', 'updateNameModal') .addToUi(); SpreadsheetApp.getUi(); } function updateNameModal () { let Spread = SpreadsheetApp.getActiveSpreadsheet(); letsheet = Spread.getSheetByName(“Sheet2”); let Values ​​=sheet.getDataRange().getValues().map( row => row[0] ); // Get the name from each row var html = HtmlService.createTemplateFromFile(“updateNameFile”); html.dropdown = value; SpreadsheetApp.getUi().showModalDialog(html.evaluate(),”Update name globally” ); }

The above script creates a modal and defines the scope of the dropdown.


Select a name from the list.

Rename it to:


function updateJobName(current_name, updated_name) { var ss = SpreadsheetApp.getActiveSpreadsheet(); varsheet = ss.getSheetByName("Sheet2"); value1 = current_name. Let value2 = updated_name. sheet.getRange("A2:A").createTextFinder(value1).replaceAllWith(value2);

The above script is[更新]It runs when the button is clicked and replaces the value in the dropdown.

Please let us know if you need more information. thank you.




The mention sources can contact us to remove/changing this article

What Are The Main Benefits Of Comparing Car Insurance Quotes Online

LOS ANGELES, CA / ACCESSWIRE / June 24, 2020, / Compare-autoinsurance.Org has launched a new blog post that presents the main benefits of comparing multiple car insurance quotes. For more info and free online quotes, please visit https://compare-autoinsurance.Org/the-advantages-of-comparing-prices-with-car-insurance-quotes-online/ The modern society has numerous technological advantages. One important advantage is the speed at which information is sent and received. With the help of the internet, the shopping habits of many persons have drastically changed. The car insurance industry hasn't remained untouched by these changes. On the internet, drivers can compare insurance prices and find out which sellers have the best offers. View photos The advantages of comparing online car insurance quotes are the following: Online quotes can be obtained from anywhere and at any time. Unlike physical insurance agencies, websites don't have a specific schedule and they are available at any time. Drivers that have busy working schedules, can compare quotes from anywhere and at any time, even at midnight. Multiple choices. Almost all insurance providers, no matter if they are well-known brands or just local insurers, have an online presence. Online quotes will allow policyholders the chance to discover multiple insurance companies and check their prices. Drivers are no longer required to get quotes from just a few known insurance companies. Also, local and regional insurers can provide lower insurance rates for the same services. Accurate insurance estimates. Online quotes can only be accurate if the customers provide accurate and real info about their car models and driving history. Lying about past driving incidents can make the price estimates to be lower, but when dealing with an insurance company lying to them is useless. Usually, insurance companies will do research about a potential customer before granting him coverage. Online quotes can be sorted easily. Although drivers are recommended to not choose a policy just based on its price, drivers can easily sort quotes by insurance price. Using brokerage websites will allow drivers to get quotes from multiple insurers, thus making the comparison faster and easier. For additional info, money-saving tips, and free car insurance quotes, visit https://compare-autoinsurance.Org/ Compare-autoinsurance.Org is an online provider of life, home, health, and auto insurance quotes. This website is unique because it does not simply stick to one kind of insurance provider, but brings the clients the best deals from many different online insurance carriers. In this way, clients have access to offers from multiple carriers all in one place: this website. On this site, customers have access to quotes for insurance plans from various agencies, such as local or nationwide agencies, brand names insurance companies, etc. "Online quotes can easily help drivers obtain better car insurance deals. All they have to do is to complete an online form with accurate and real info, then compare prices", said Russell Rabichev, Marketing Director of Internet Marketing Company. CONTACT: Company Name: Internet Marketing CompanyPerson for contact Name: Gurgu CPhone Number: (818) 359-3898Email: [email protected]: https://compare-autoinsurance.Org/ SOURCE: Compare-autoinsurance.Org View source version on accesswire.Com:https://www.Accesswire.Com/595055/What-Are-The-Main-Benefits-Of-Comparing-Car-Insurance-Quotes-Online View photos


to request, modification Contact us at Here or [email protected]