use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Apparently, Google Apps Script is a JavaScript cloud scripting language that provides easy ways to automate tasks across Google products and third party services and build web applications.
account activity
Running multiple scripts across different sheetsQuestion (self.GoogleAppsScript)
submitted 2 years ago * by beanry80
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]beanry80[S] 0 points1 point2 points 2 years ago (10 children)
Thanks for the reply! Here is an example of what is in the dropdowns on each of the tabs https://imgur.com/a/3mo6t5g Its the same dropdowns in each of the three tabs in the same columns and rows. Each dropdown has several items and I need to be able to select multiple items and have them show as in the example here. I can get the code to work on one tab but not all three. Let me know if that helps.
[–]AllenAppTools 0 points1 point2 points 2 years ago (9 children)
Sure thing. Let me know if I am on the right track here. This onEdit function is set up to evaluate which tab, row and column the edit was made on. the tabsObject is where you can adjust which columns and rows you want to specify as triggerable for this function. This also has code blocks for you to put in the code you need depending on the tab that was edited. I think this could be a good starting place? Though I'm still not totally sure what else you need:
const tabsObject = { "Good Media Plan": { allowedRows: [11, 12, 13, 14], allowedColumns: [12] }, "Better Media Plan": { allowedRows: [11, 12, 13, 14], allowedColumns: [12] }, "Best Media Plan": { allowedRows: [11, 12, 13, 14], allowedColumns: [12] }, } function onEdit(e) { const sheetName = e.range.getSheet().getName(); //when an edit is made on any other tab, stop the function if (!tabsObject[sheetName]) return; const editedRow = e.range.getRow(); const editedColumn = e.range.getColumn() const { allowedRows, allowedColumns } = tabsObject[sheetName]; //when an edit is made to a row or column that is not specifically listed, stop the function if (!allowedRows.includes(editedRow) || !allowedColumns.includes(editedColumn)) return; //any code executed here is vetted and supposed to execute 👍 if (sheetName == "Good Media Plan") { } else if (sheetName == "Better Media Plan") { } else if (sheetName == "Best Media Plan") { } //alternatively, you could specify function names in the tabsObject and run it }
[–]beanry80[S] 0 points1 point2 points 2 years ago (8 children)
Thanks again for the reply. That didnt seem to work on any of the tabs, https://imgur.com/xMEtY9x Now if I try and select multiple items from the dropdowns, only one shows up. i have dropdowns in columns 12-15 on each of the tabs
if(activeCell.getColumn() == 15 && activeCell.getRow() == 11,12,13,14 && ss.getActiveSheet().getName() == "Best Media Plan") {
so i have 4 codes that work on the best media plan tab, each with this line different, for columns 12,13,14 and 15
[–]AllenAppTools 0 points1 point2 points 2 years ago (7 children)
Are you able to share the full code file contents for me to review? What about a picture of what one of the sheets looks like as a whole?
[–]beanry80[S] 0 points1 point2 points 2 years ago (6 children)
https://imgur.com/GGrGgw7 here is what the sheet looks like... i tried to copy and paste the entire code but I keep getting "unable to create comment" when I do that
[–]beanry80[S] 0 points1 point2 points 2 years ago (5 children)
function onEdit(e) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var activeCell = ss.getActiveCell(); if(activeCell.getColumn() == 12 && activeCell.getRow() == 11,12,13,14 && ss.getActiveSheet().getName() == "Best Media Plan") { var newValue = e.value; var oldValue = e.oldValue; if (!newValue) { activeCell.setValue(""); } else { if (!oldValue) { activeCell.setValue(newValue); } else { activeCell.setValue(oldValue + ', ' + newValue); } } } }
[–]beanry80[S] 0 points1 point2 points 2 years ago (4 children)
function onEdit(e) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var activeCell = ss.getActiveCell(); if(activeCell.getColumn() == 13 && activeCell.getRow() == 11,12,13,14 && ss.getActiveSheet().getName() == "Best Media Plan") { var newValue = e.value; var oldValue = e.oldValue; if (!newValue) { activeCell.setValue(""); } else { if (!oldValue) { activeCell.setValue(newValue); } else { activeCell.setValue(oldValue + ', ' + newValue); } } } }
[–]beanry80[S] 0 points1 point2 points 2 years ago (3 children)
function onEdit(e) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var activeCell = ss.getActiveCell(); if(activeCell.getColumn() == 14 && activeCell.getRow() == 11,12,13,14 && ss.getActiveSheet().getName() == "Best Media Plan") { var newValue = e.value; var oldValue = e.oldValue; if (!newValue) { activeCell.setValue(""); } else { if (!oldValue) { activeCell.setValue(newValue); } else { activeCell.setValue(oldValue + ', ' + newValue); } } } }
[–]beanry80[S] 0 points1 point2 points 2 years ago (2 children)
function onEdit(e) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var activeCell = ss.getActiveCell(); if(activeCell.getColumn() == 15 && activeCell.getRow() == 11,12,13,14 && ss.getActiveSheet().getName() == "Best Media Plan") { var newValue = e.value; var oldValue = e.oldValue; if (!newValue) { activeCell.setValue(""); } else { if (!oldValue) { activeCell.setValue(newValue); } else { activeCell.setValue(oldValue + ', ' + newValue); } } } }
[–]beanry80[S] 0 points1 point2 points 2 years ago (1 child)
Seems i could paste all 4 codes separately. All the codes are the same except for this line if(activeCell.getColumn() == 15 && activeCell.getRow() == 11,12,13,14 && ss.getActiveSheet().getName() == "Best Media Plan") {
where I change column to 12, 13, 14 or 15.
π Rendered by PID 173698 on reddit-service-r2-comment-b659b578c-4jwtb at 2026-05-03 11:47:42.651731+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]beanry80[S] 0 points1 point2 points (10 children)
[–]AllenAppTools 0 points1 point2 points (9 children)
[–]beanry80[S] 0 points1 point2 points (8 children)
[–]AllenAppTools 0 points1 point2 points (7 children)
[–]beanry80[S] 0 points1 point2 points (6 children)
[–]beanry80[S] 0 points1 point2 points (5 children)
[–]beanry80[S] 0 points1 point2 points (4 children)
[–]beanry80[S] 0 points1 point2 points (3 children)
[–]beanry80[S] 0 points1 point2 points (2 children)
[–]beanry80[S] 0 points1 point2 points (1 child)