Skip to content

Instantly share code, notes, and snippets.

View Doomd's full-sized avatar
:octocat:
Focusing

Doomd Doomd

:octocat:
Focusing
View GitHub Profile
@Doomd
Doomd / code.gs
Last active April 7, 2023 10:58
Google App Scripts - Sheets - Determine if event/active cell is inside a Named Range
// If you want to do determine if the active/edited cell is inside one of your named ranges, use this.
// In the example below, I actually have a named range "formatRanges" that lists all of the other...
// named ranges that I consider format ranges (for a template I've made)...
// I am doing some fancy formatting (in another function) that needs to only be done
// if the cell I'm editing is considered a source cell inside one of my format ranges
// If you want to target ALL of your spreadsheet's named ranges, use this instead:
//>>> var namedRanges = SpreadsheetApp.getActiveSpreadsheet().getNamedRanges();
// This method will grab an array of ALL the named ranges, instead of just a specific selection
function doWeFormat(e) { //"e" is basically the recently edited cell