Prevent editors from modifying a dropdown list in Google Sheets with Apps Script
Scott Yagisanatode
Learn how to retrieve existing Dropdown from a Range Data Validation rules in Google Sheets using Google Apps Script by creating a a macro that prevents other editors from modifying a dropdown list in Google Sheets with Apps Script.
With the enforced inclusion of the 'edit' button in dropdown lists in Google Sheets now, more and more Spreadsheet Owners are complaining that editors are adding new dropdown selections or completely editing the dropdown. In this tutorial, I will show you how to revert the dropdown to the original rules using Google Apps Script.
To the Starter Sheet, adventurer!: https://docs.google.com/spreadsheets/d/1gOtwAUDqpzEsD2KCeq1Rwz8IwicYMIM2XFV4MF-xDjk/copy
Some Limitations
The editor still has access to the bound Google Apps Script. Here you might consider a few approaches:
- Put the script in a library.
- Obfuscate the code.
- Build the script as an Editor Add-on.
Of course, sometimes it is simply better to carry our selections and other actions in a dialogue box, check out this tutorial series on the topic: https://www.youtube.com/playlist?list=PLSDEbLgMgqvrwnVekQKlrx1Zyi1tUFsyY
You might also want to build a custom Google Apps Script WebApp. Here, you can embed a form for your Google Sheet right into your own website or a Google Site or just share the WebApp URL. : https://yagisanatode.com/category/code/google-apps-script/web-app/
00:00 What we're building. 01:50 The starter script. 02:53 onEdit() 05:47 preventDropdownEdits() 06:21 Build dropdown data validation 10:27 Check data validation exists 12:30 Check data validation type 16:57 Incorrect dropdown source range 22:42 Check help text 24:52 Check validation enforced 26:47 Copy Data Validation rules
** My Site ** https://yagisanatode.com/
** More on Google Apps Script ** https://yagisanatode.com/google-apps-script/
** Products ** Create and Publish Google Workspace Add-ons with Google Apps Script: Master Class https://yagisanatode.com/products/create-and-publish-google-workspace-add-ons-with-google-apps-script-master-class/
Courses * https://yagisanatode.com/products-category/courses/
Google Workspace Tools * https://yagisanatode.com/products-category/google-workspace-tool/
Google Workspace Add-ons * https://yagisanatode.com/products-category/gwao/
#googleworkspace #googleappsscript #googlesheets #admin #businessadministration @googleworkspacedevs #datavalidation ... https://www.youtube.com/watch?v=SQIq99L8MXE
136934346 Bytes