---
title: "Get all selected Ranges in Google Sheets with Google Apps Script"
author: "Phil Bainbridge"
date: 2022-05-25T08:33:00+00:00
modified: 2022-05-25T07:14:27+00:00
canonical_url: https://pulse.appsscript.info/p/2022/05/get-all-selected-ranges-in-a-google-sheet/
markdown_url: https://pulse.appsscript.info/p/2022/05/get-all-selected-ranges-in-a-google-sheet.md
categories:
  - "Beginner"
  - "Sheets"
  - "Snippet"
tags:
  - "pbainbridge.co.uk"
featured_image: https://pulse.appsscript.info/files/2022/05/Selected-Ranges.png
description: "In this Pulse contribution from Phil Bainbridge he looks at how Google Apps Script can be used when multiple ranges are selected/highlighted by a user in Google Sheets"
---

# Get all selected Ranges in Google Sheets with Google Apps Script

![Get all selected Ranges in Google Sheets with Google Apps Script](https://pulse.appsscript.info/files/2022/05/Selected-Ranges.png)

> Get all selected Ranges in a Google Sheet along with values, row and column details.
> [https://www.pbainbridge.co.uk/2022/05/get-all-selected-ranges-in-google-sheet.html](https://www.pbainbridge.co.uk/2022/05/get-all-selected-ranges-in-google-sheet.html)Selected ranges in a Google Sheet

The following Google Apps Script was from some learning around multiple ranges being selected/highlighted by a user in a Google Sheet. I have always worked with individual cells or continuous ranges within Sheets, but during the development of my [Archive Sheet data Add-on**](https://www.pbainbridge.co.uk/p/archive-sheet-data-add-on.html) I wanted to enhance it by allowing more rows to be acted upon in one go.

I practiced getting a few values after looping through each selected range:

- A1 Notation (e.g. A2:C5),
- Cell values,
- Starting row,
- End row,
- Number of rows (calculated from the above),
- Starting column,
- End column,
- Number of columns (calculated from the above).

Source: *[The Gift of Script: Get all selected Ranges in a Google Sheet*](https://www.pbainbridge.co.uk/2022/05/get-all-selected-ranges-in-google-sheet.html)

---

*Published by [Phil Bainbridge](https://pulse.appsscript.info/p/author/phillipbainbridge/) on [Pulse](https://pulse.appsscript.info/). Original article: [https://pulse.appsscript.info/p/2022/05/get-all-selected-ranges-in-a-google-sheet/](https://pulse.appsscript.info/p/2022/05/get-all-selected-ranges-in-a-google-sheet/)*
