How to Get the ID of a Google Sheet Quickly

Dave | December 13, 2022 |

It’s quick and easy to get the ID of a Google Spreadsheet or Sheet Tab from its URL. If you have the sheet open in your browser, you should be able to see the URL within the address bar. The Spreadsheet ID comprises letters, numbers, hyphens and underscores and is the part of the URL after the docs.google.com/spreadsheets/d/ and ends before the next /.

When you open a Google Sheets file from your drive or computer, you probably think of this as a ‘Sheet‘. But actually the more correct terminology for it is a ‘Spreadsheet‘. Within your ‘Spreadsheet’ there may be one or more tabs or ‘Sheets‘.

The ID of the currently focused sheet within the spreadsheet you have opened is also part of the URL, the bit after gid=. You can see both parts highlighted in the URL in the address bar of Chrome below.

A sheet URL in Chrome with the spreadsheet ID and sheet ID highlighted
A spreadsheet ID (first) and sheet ID (second) parts of a docs URL

Here are a few examples to highlight:

Example 1:

Sheet URL:
https://docs.google.com/spreadsheets/d/1QPvcIcmNU1QbZYRF__rrjIC4C1F0Ir3KI-YtIRCCWws/edit#gid=0

Spreadsheet ID = 1QPvcIcmNU1QbZYRF__rrjIC4C1F0Ir3KI-YtIRCCWws 
Sheet ID = 0 (zero usually means this is the first or only tab in the spreadsheet)

Sheet URL:
https://docs.google.com/spreadsheets/d/1vqnkf65XGiFzr3UHETkKA0qjnwSYHPzUI4vjUJJKW0E/edit#gid=1930268077

Spreadsheet ID = 1vqnkf65XGiFzr3UHETkKA0qjnwSYHPzUI4vjUJJKW0E
Sheet ID = 1930268077

Getting a sheet ID from the sheet URL

There’s a really quick way of selecting the spreadsheet ID or sheet ID from the URL shown in your address bar. Normally, if you simply double click on the section of the URL that contains the ID you want, it will automatically get selected. So you can quickly copy it using Ctrl+c or + c. The exception to this is when the ID contains hyphens (-). These mean you can only quickly select PART of the ID quickly and have instead to drag or cursor between the first / and last /.

Double clicking inside a URL on the sheet ID part
Quickly select an ID by double-clicking anywhere inside it

Getting a sheet ID from Google Drive

If you open your Google Drive in a browser and right-click on a Google Spreadsheet file, you will see a menu that has a Get link option.

Context menu on a Google Drive file
Get link

If you open this option, you will see the sharing settings window for the file. This window domains a Copy link button, this button will copy the URL of your sheets file to the clipboard.

Sharing settings with copy link highlighted
The link will contain the sheet ID

All you then need to do is paste the URL into your favorite text editor and extract the sheet ID!

Getting a sheet ID on mobile

The same Copy link button is available when you use the three dot button next to a file on your mobile drive app. If you copy a link to the sheet, you can then extract the spreadsheet ID.

Mobile drive app context menu
Mobile drive
Dave

I'm a Google Product Expert and mainly post on the subject of Google Sheets.

I've been a software engineer for over 20 years. The constant through all that time? Spreadheets.... Even though I can write programs I use them.... a lot. Sometimes there's just no better alternative!

Find out more about me here.

Leave a Comment