Assigned
Status Update
Comments
vf...@valeo.com <vf...@valeo.com> #2
would be useful!
pi...@gmail.com <pi...@gmail.com> #3
much needed
ma...@skynet4.com <ma...@skynet4.com> #4
I need to monitor active sheet because I have different side bar for every sheet. What I'm doing now is running a JavaScript from the client side every 1s (second) to call google.script.run.monitorTabChange();. This function reads current active sheet's name and compares it with a sheet name that had been saved in a PropertyService during the last call of google.script.run.monitorTabChange();.
The spreadsheet with this script helps me with creating Purchase Orders. It pulls data from Salesforce and Quickbooks and generates a PO. So for every PO for every customer I am duplicating the spreadsheet and of course the script. The problem that I am facing is running out of quota. I have generated tons of POs already and each of them runs (even if the spreadsheet is not opened - I tested it) the 'monitorTabChange' function, which calls PropertyService. I have 100 000 quota for PropertyService calls. And I'm running out of it pretty quickly now.
The trigger 'OnSheetChange' would then save me (probably many others too) from this issue. At the same time it would saved Google tons of execution overhead (that could be significant if lots of people use the solution I do to track the sheet change).
Thanks!
The spreadsheet with this script helps me with creating Purchase Orders. It pulls data from Salesforce and Quickbooks and generates a PO. So for every PO for every customer I am duplicating the spreadsheet and of course the script. The problem that I am facing is running out of quota. I have generated tons of POs already and each of them runs (even if the spreadsheet is not opened - I tested it) the 'monitorTabChange' function, which calls PropertyService. I have 100 000 quota for PropertyService calls. And I'm running out of it pretty quickly now.
The trigger 'OnSheetChange' would then save me (probably many others too) from this issue. At the same time it would saved Google tons of execution overhead (that could be significant if lots of people use the solution I do to track the sheet change).
Thanks!
ka...@gmail.com <ka...@gmail.com> #5
will really appreciate this feature :)
[Deleted User] <[Deleted User]> #6
I'd like an onSwitchSheets event trigger with the following information available:
The sheet I'm switching from, active cell I'm switching from, active row I'm switching from, active col I'm switching from etc.
The sheet I'm switching to with ability to:
- land in a specific cell
- modify the contents of a cell or range of cells in the switch to sheet
- initiate a re-calculate in the target sheet after changes have been made.
Even better... onPreSwitch, onSwitch, onPostSwitch
Excessive code is required to implement the functionality I'm chasing without these hooks.
The sheet I'm switching from, active cell I'm switching from, active row I'm switching from, active col I'm switching from etc.
The sheet I'm switching to with ability to:
- land in a specific cell
- modify the contents of a cell or range of cells in the switch to sheet
- initiate a re-calculate in the target sheet after changes have been made.
Even better... onPreSwitch, onSwitch, onPostSwitch
Excessive code is required to implement the functionality I'm chasing without these hooks.
al...@eu.averydennison.com <al...@eu.averydennison.com> #7
Any news from Google team?
i Would like to re-hide hidden sheets when user leaves it
i Would like to re-hide hidden sheets when user leaves it
t2...@woolworths.com.au <t2...@woolworths.com.au> #8
Hey Google,
This feature is highly in need for us. Can you please respond?
This feature is highly in need for us. Can you please respond?
ld...@gmail.com <ld...@gmail.com> #9
This trigger would also be useful for the code I'm working on.
am...@gmail.com <am...@gmail.com> #10
very mandatory
ab...@cusdk8.org <ab...@cusdk8.org> #11
Needed!
me...@gmail.com <me...@gmail.com> #12
would be greatly apreciated
st...@gmail.com <st...@gmail.com> #13
I need something like this too
so...@gmail.com <so...@gmail.com> #14
Yes please - I have a goto last row but it only runs on open; would be great to run on every tab/sheet change
la...@netic.dk <la...@netic.dk> #15
Come on... I was happy to see the way Google implemented apps vs MS vba and decided to convert several off my office documents to google sheets, but there is no way this is going to happen without support for this "onSheetChange" feature. It really makes me wonder how many other basic features are missing in sheets. It only took 10 min. of investigation to put sheets on hold....
ai...@gmail.com <ai...@gmail.com> #16
I have a sidebar that shows filters for the active sheet - when you change the sheet I need to reconfigure my sidebar.
At the moment I use a mouse-over event on my sidebar AND a timer function to constantly monitor the current sheet.
It would be so much better if there were a trigger on sheet change.
Thanks
At the moment I use a mouse-over event on my sidebar AND a timer function to constantly monitor the current sheet.
It would be so much better if there were a trigger on sheet change.
Thanks
in...@gsuitescript.com <in...@gsuitescript.com> #17
Really need this feature and it seems like something that would be very simple to implement. Knowing the current sheet is crucial for lots of operations and constantly checking that it hasn't changed seems very wasteful.
re...@comvation.com <re...@comvation.com> #18
Need this, too
[Deleted User] <[Deleted User]> #19
One and a half year, no update yet...
em...@inmar.com <em...@inmar.com> #20
Oh come on Google folks! Surely you can incorporate this! Soooooooooo many people want this and really need it!
vn...@gmail.com <vn...@gmail.com> #21
up
ma...@gmail.com <ma...@gmail.com> #22
+
[Deleted User] <[Deleted User]> #23
+
tl...@gmail.com <tl...@gmail.com> #24
Please Google team - this would be very helpful!!
lm...@bulley.com <lm...@bulley.com> #25
+
da...@gmail.com <da...@gmail.com> #26
+
nu...@gmail.com <nu...@gmail.com> #27
Hello? Can't believe this hasn't been added yet.
[Deleted User] <[Deleted User]> #28
Is this getting added ? Google team are you guys listening?
cr...@gmail.com <cr...@gmail.com> #29
I really need this trigger. Please add. Is anyone responding to this request?
so...@gmail.com <so...@gmail.com> #30
There is at least 1 workaround posted about that I know of if anyone is desperate. It's a bit pffft though based on a timer from memory. I'm not that desperate ...
so...@gmail.com <so...@gmail.com> #31
I haven't actually tried them & I know some voters here may even be the contributors but in case anyone is frazzled for a workaround & hasn't come across them, even if a bit hacky >>
https://stackoverflow.com/questions/38160116/trigger-when-user-switches-between-sheets
https://webapps.stackexchange.com/questions/91812/how-can-i-trigger-a-function-when-switching-sheets-within-a-spreadsheet
[Deleted User] <[Deleted User]> #32
+
ed...@gmail.com <ed...@gmail.com> #33
need it also
yo...@gmail.com <yo...@gmail.com> #34
+
mg...@gmail.com <mg...@gmail.com> #35
+
jc...@gmail.com <jc...@gmail.com> #36
Needed
[Deleted User] <[Deleted User]> #37
On change sheet would be very useful
za...@gmail.com <za...@gmail.com> #38
Really needed.
rt...@googlemail.com <rt...@googlemail.com> #39
Needed. I want to reset something as soon as a particular sheet is viewed.
pe...@gosford.kwikkopy.com.au <pe...@gosford.kwikkopy.com.au> #40
Come on Google, this has been around for years ... would give greater control of the user experience if changing sheets causes an action.
ot...@gmail.com <ot...@gmail.com> #41
This will be a great feature. thanks
gr...@velvet-dps.tech <gr...@velvet-dps.tech> #42
I think the reason this is not a simple update: What is the "Active Sheet" when there are multiple collaborators in the doc? But, all the tools are provided to handle:
On your script hooks, use Session.getActiveUser().getEmail()
and SpreadsheetApp.getActive().getActiveSheet().getSheetId()
. Then keep a dictionary in CacheService
or Properties
that maps user-email to active-sheet. In subsequent executions, if this value changes, then you know which user has changed tabs.
do...@gmail.com <do...@gmail.com> #43
YESSSSS THIS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ka...@gmail.com <ka...@gmail.com> #44
Thanks for your input @gr...@velvet-dps.tech. However, if I would do as you suggest and create that dictionary in CacheService or Properties is it possible to fire a trigger when this dictionary is changed such that my desired function would run immediately e.g. make active cell matching the last one cell in the last row of the active sheet after a user in the gsheet changes the tab?
sc...@iolani.org <sc...@iolani.org> #45
I would like it too!
[Deleted User] <[Deleted User]> #46
This would be useful for addon script to be able to detect which sheet is active and adjust content in the addon based on the current sheet.
ja...@google.com <ja...@google.com> #47
Hello! Thanks for your feedback.
This request has been submitted to the appropriate team.
Cheers!
le...@airliquide.com <le...@airliquide.com> #48
I need this feature as well! It was available in Excel Macros and I'm converting scripts to Google sheets
lu...@gmail.com <lu...@gmail.com> #49
Waiting!!
ka...@gmail.com <ka...@gmail.com> #51
Thanks for the tutorial on how to use onSelectionChange!
However there is one thing that does not work for me. I would like to activate a specific cell when switching tabs. For some reason the function SpreadsheetApp.setActiveRange(activeRange) does not work within onSelectionChange(e). Interestingly, the functionality of SpreadsheetApp.setActiveRange(activeRange) does work when used within onOpen(e). Any idea on why that is the case?
However there is one thing that does not work for me. I would like to activate a specific cell when switching tabs. For some reason the function SpreadsheetApp.setActiveRange(activeRange) does not work within onSelectionChange(e). Interestingly, the functionality of SpreadsheetApp.setActiveRange(activeRange) does work when used within onOpen(e). Any idea on why that is the case?
is...@google.com <is...@google.com>
sh...@gmail.com <sh...@gmail.com> #52
please google, add this trigger for us
dl...@gmail.com <dl...@gmail.com> #53
Here is my work-around for onSheetChange:
function saveActiveSheet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var actsheet = ss.getActiveSheet();
// The onSelectionChange() function executes in a separate thread
// which does not use any script global variables, so use the
// PropertiesService to maintain the user global state.
var userProperties = PropertiesService.getUserProperties();
userProperties.setProperty('ACTIVE_SHEET', actsheet.getSheetName());
}
function onSheetChange(e) {
// Do anything needed after a new sheet/tab selection
}
function onSelectionChange(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
// Get current sheet name and compare to previously saved sheet
var currentactsheet = ss.getActiveSheet();
var currentactsheetname = currentactsheet.getSheetName();
var userProperties = PropertiesService.getUserProperties();
var actsheetname = userProperties.getProperty('ACTIVE_SHEET');
if (currentactsheetname !== actsheetname) { // New sheet selected
saveActiveSheet();
onSheetChange(e); // Call custom sheet change trigger
}
// Do anything needed when a different range is selected on the same sheet
else {
var range = e.range;
}
}
function onOpen(e) {
saveActiveSheet();
}
function saveActiveSheet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var actsheet = ss.getActiveSheet();
// The onSelectionChange() function executes in a separate thread
// which does not use any script global variables, so use the
// PropertiesService to maintain the user global state.
var userProperties = PropertiesService.getUserProperties();
userProperties.setProperty('ACTIVE_SHEET', actsheet.getSheetName());
}
function onSheetChange(e) {
// Do anything needed after a new sheet/tab selection
}
function onSelectionChange(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
// Get current sheet name and compare to previously saved sheet
var currentactsheet = ss.getActiveSheet();
var currentactsheetname = currentactsheet.getSheetName();
var userProperties = PropertiesService.getUserProperties();
var actsheetname = userProperties.getProperty('ACTIVE_SHEET');
if (currentactsheetname !== actsheetname) { // New sheet selected
saveActiveSheet();
onSheetChange(e); // Call custom sheet change trigger
}
// Do anything needed when a different range is selected on the same sheet
else {
var range = e.range;
}
}
function onOpen(e) {
saveActiveSheet();
}
an...@gmail.com <an...@gmail.com> #54
agreed this would be very helpful.
ra...@gmail.com <ra...@gmail.com> #55
Much needed, Google please update
bw...@gmail.com <bw...@gmail.com> #56
Ditto! (would be a very helpful trigger.)
bo...@szeto.app <bo...@szeto.app> #57
Agreed!
ro...@gillandroy.com <ro...@gillandroy.com> #58
Very much needed functionality.
ja...@celbux.com <ja...@celbux.com> #59
Please add this trigger! 2 years since a Google employee has said anything about this, and there is no assignee. Very sad
je...@gmail.com <je...@gmail.com> #60
I could definitely do with this please.
al...@gmail.com <al...@gmail.com> #61
Would like this trigger as well... It is needed!
vi...@gmail.com <vi...@gmail.com> #62
Same here, onSelectionChange doesn't always work. So, i need this trigger
jh...@gmail.com <jh...@gmail.com> #63
Any updates on this?
an...@gmail.com <an...@gmail.com> #64
I need this
kr...@contractors.roche.com <kr...@contractors.roche.com> #65
agreed this would be very helpful.
wi...@widescreenmusic.com <wi...@widescreenmusic.com> #66
+1
ma...@gmail.com <ma...@gmail.com> #67
Very much needed.
jp...@google.com <jp...@google.com>
ph...@roche.com <ph...@roche.com> #68
Very much needed. I don't know why this trigger doesn't exist yet.
mu...@gmail.com <mu...@gmail.com> #69
I hope google sheets will come up with this.
te...@gmail.com <te...@gmail.com> #70
Looking for this feature for my implementation as well.
Want to refresh the add on sidebar when the sheet tab changes.
Since OnSelectionChange is simple trigger, it doesn't allow running showSidebar function.
Want to refresh the add on sidebar when the sheet tab changes.
Since OnSelectionChange is simple trigger, it doesn't allow running showSidebar function.
cd...@ecstuning.com <cd...@ecstuning.com> #71
+1
an...@quickfixters.com <an...@quickfixters.com> #72
Please implement this asap, this is very much needed, especially for product development.
Description
I want bound script to event "user changed sheet". But there is no such trigger to bound to..
What is the purpose of this new feature?
I can than run sume functions when user move to another sheet tab. for eg. set active cell to last row, so user dont have to always scroll down.
What existing Apps Script services would this affect?
Goohle sheets, google apps script
Please provide any additional information below:
There is some workaround with use of sidepanel (checking in loop which sheet is opened):