---
title: "Change Tab Detection on Google Spreadsheet using onSelectionChange Event Trigger with Google Apps Script"
author: "Martin Hawksey"
date: 2020-05-18T15:48:50+00:00
canonical_url: https://pulse.appsscript.info/p/2020/05/change-tab-detection-on-google-spreadsheet-using-onselectionchange-event-trigger-with-google-apps-script/
markdown_url: https://pulse.appsscript.info/p/2020/05/change-tab-detection-on-google-spreadsheet-using-onselectionchange-event-trigger-with-google-apps-script.md
categories:
  - "Sheets"
  - "Snippet"
tags:
  - "GitHub"
  - "tanaikech"
  - "tanaikech.github.io"
description: "Change Tab Detection on Google Spreadsheet using onSelectionChange Event Trigger with Google Apps Script - submit.md An example script from Kanshi TANAIKE which lets you test the new onSelectionChange(e) simple event trigger in Google Sheets. The onSelectionChange(e) trigger..."
---

# Change Tab Detection on Google Spreadsheet using onSelectionChange Event Trigger with Google Apps Script

> [https://gist.github.com/tanaikech/524c16dbef722763f80312357d0e4368](https://gist.github.com/tanaikech/524c16dbef722763f80312357d0e4368)
> Change Tab Detection on Google Spreadsheet using onSelectionChange Event Trigger with Google Apps Script – submit.md

An example script from Kanshi TANAIKE which lets you test the new `onSelectionChange(e)` simple event trigger in Google Sheets.

> The `onSelectionChange(e)` trigger runs automatically when a user changes the selection in a spreadsheet.

In the example shared this is used to detect the user changing Google Sheet tab.

Source: *[Change Tab Detection on Google Spreadsheet using onSelectionChange Event Trigger with Google Apps Script*](https://gist.github.com/tanaikech/524c16dbef722763f80312357d0e4368)

---

*Published by [Martin Hawksey](https://pulse.appsscript.info/p/author/admin/) on [Pulse](https://pulse.appsscript.info/). Original article: [https://pulse.appsscript.info/p/2020/05/change-tab-detection-on-google-spreadsheet-using-onselectionchange-event-trigger-with-google-apps-script/](https://pulse.appsscript.info/p/2020/05/change-tab-detection-on-google-spreadsheet-using-onselectionchange-event-trigger-with-google-apps-script/)*
