Learn how to use Google Apps Script within Google Sheets to clear the contents of a cell when another cell is edited. This video relates to the Dependent Dropdown Chips, so if you haven't seen this, you can check it out here: https://youtu.be/znD9RE3dURY
Google Apps Script used in this demo:
function onEdit(e) {
// Extract relevant data from the event object
var range = e.range;
var sheet = range.getSheet();
// Check if the edit is on the correct sheet and row
if (sheet.getName() === 'Sheet1' && range.getRow() === 2) {
if (range.getColumn() === 2) {
// Clear cells C2:D2 if column B (2) is edited
sheet.getRange('C2:D2').clearContent();
} else if (range.getColumn() === 3) {
// Clear cell D2 if column C (3) is edited
sheet.getRange('D2').clearContent();
}
}
}
For more videos and/or to subscribe, check out this link
https://www.youtube.com/@spreadsheetwise
Chapters
00:33 - Apps Script
02:36 - Script Permissions
03:30 - Run Script using the Sheet
03:52 - Final Script
Social Channels
https://twitter.com/SpreadsheetW
https://www.instagram.com/spreadsheetwise/
https://www.facebook.com/spreadsheetwise/
https://www.pinterest.co.uk/SpreadsheetWise/
#googleappsscript #appsscript #GoogleSheetsDropdownChips #Dropdown #dropdownmenu #dropdownlist #dependance #dependantdropdown #Spreadsheet #GoogleSheetsTipsAndTricks #GoogleSheetsHacks #googlesheets #googlesheetstutorial #Spreadsheetwise