1

How do I trigger a function (for e.g., a function named "DataTrend") when the user brings focus to a worksheet.

I have three worksheets -

  1. Dashboard
  2. Iteration Data Trend
  3. PI 4 Iteration Tracker

Whenever user clicks on "Dashboard" and brings focus to that worksheet, I want to call the function "DataTrend".

Rubén
  • 34,714
  • 9
  • 70
  • 166
Jrules80
  • 178
  • 12

1 Answers1

-1

There is no trigger onOpen of a sheet in Apps Script. If you go to Google Issue Tracker, you will see that there is already an existing request for this feature. You can click the ⭐ next to the issue number to subscribe to that request, so you can receive updates about its development.

Jacques-Guzel Heron
  • 2,480
  • 1
  • 7
  • 16
  • 1
    To be clear, there is an `onOpen` trigger. There is not an `onFocus` trigger. https://developers.google.com/apps-script/guides/triggers/ – Efficient Small Business Sep 16 '19 at 16:46
  • Hi there @EfficientSmallBusiness, I read that doc and realized our misunderstanding: a sheet is a data file created and used by a spreadsheet. On the reverse, a spreadsheet can be loosely defined as a collection of sheets. In the docs that you linked it says _"`onOpen(e)` runs when a user opens a spreadsheet, document, presentation, or form"_, in other words, the trigger only works in relation to the spreadsheet, not the sheet per se. I see no references to `onFocus` whatsoever. I hope to have clear our misapprehension, but don't hesitate to write again if you need further clarification. – Jacques-Guzel Heron Sep 17 '19 at 07:27