+ 2

Help selecting sheet in Google Sheets code?

I’m havjng some trouble selecting a specific sheet as a condition for a function, I’ll try to explain what I’m trying to do. It’s a google apps script code, to sort a table in google sheets. It detects when a cell in column ‘P’ is edited (column 16) and then sorts the table according to the data in that column. I have a simple checkbox in column P, so when the checkbox is ticked the entire row of the table is moved to the bottom. The data in this row is then converted into ‘contentsOnly’ so that the formulas that previously inhabited the cells in this row no longer operate on new values. This all works perfectly well. The problem I’m having is that I’d like the code to only detect changes to column ‘P’ being made in the sheet “Playground”, but it detects changes across all sheets in the active spreadsheet. So I could go to a different sheet, and if I edit a cell in column ‘P’ then the table will be sorted and the bottom row will be converted to ‘contentsOnly’ even though I haven’t edited anything on the “Playground” sheet. I haven’t been able to figure out what the problem is, though I suspect it may be in the ‘editedCell’ or the ‘columnToSortBy’ variables. JavaScript code can be found below. https://code.sololearn.com/cTSu47pZBj1Y/?ref=app

20th Sep 2019, 12:23 PM
Juan
1 Antwort
+ 1
Can you please tell me that where is your Excel Sheet 'Playground'?
8th Oct 2019, 12:59 AM
AÍąJ
AÍąJ - avatar