Google Sheets Spreadsheet Key: How to Find It Fast
In this article
A Google Sheets spreadsheet key is the long string of letters and numbers in the middle of your spreadsheet's URL. It uniquely identifies your sheet, and you need it when connecting the sheet to scripts, automation tools, or apps like Zapier or Make. Finding it takes seconds: just open the spreadsheet and copy the section of the URL between "/d/" and "/edit". This guide shows you exactly where to look and how to use it.
What You'll Need
- A Google account with access to the spreadsheet (either you own it or it was shared with you)
- A browser on a desktop or laptop (the URL is easiest to read there)
- The spreadsheet already created in Google Sheets
Step-by-Step
- Open your browser and go to sheets.google.com, or go straight to drive.google.com and find the file there.
- Open the spreadsheet you want the key for. It must open in Google Sheets, not in preview mode. If Drive shows only a preview, click Open with Google Sheets at the top.
- Look at the address bar. The URL follows this pattern:
https://docs.google.com/spreadsheets/d/KEY/edit#gid=0 - The spreadsheet key is the long text between /d/ and /edit. It is typically around 44 characters made up of letters, numbers, hyphens and underscores. For example, in
https://docs.google.com/spreadsheets/d/1aBcD_eFgHiJkLmNoPqRsTuVwXyZ0123456789abcdeF/edit
the key is 1aBcD_eFgHiJkLmNoPqRsTuVwXyZ0123456789abcdeF. - Select just that section in the address bar, being careful not to include the slashes or the word "edit". Copy it with Ctrl+C (Windows) or Cmd+C (Mac).
- Paste the key wherever your tool or script asks for a "spreadsheet ID", "sheet ID" or "document key". These terms all refer to the same string.
- If your tool also asks for a sheet name or gid, that is different from the key. The gid is the number after "#gid=" in the URL and identifies a specific tab inside the spreadsheet, not the whole file.
- If you need the key on mobile, open the Sheets app, tap the three-dot menu in the top right, and use the share or link option to copy the file's link, then paste it somewhere (like a note) to read the key from the URL. The mobile app does not display the URL in an address bar, so copying the link is the practical route.
Menu labels and button positions can differ slightly between app versions and between Android and iPhone, so if a label does not match exactly, look for the option that copies or shares the file link.
Common Mistakes
- Copying the whole URL instead of just the key. Most tools reject a full URL when they ask for a spreadsheet ID. Only the string between /d/ and /edit is the key.
- Including the slashes. A key starting or ending with "/" will fail validation. Triple-check before pasting.
- Confusing the gid with the key. The gid (a short number like 0 or 123456789) identifies one tab, not the spreadsheet. Apps asking for the "spreadsheet ID" want the long key.
- Using a Google Docs URL. Docs, Sheets and Slides each have their own key format, and a Docs key will not work in a Sheets integration.
- Assuming the key is a password. The key is not secret by itself, but anyone who has it and editing or viewing access can open your file. Still, share links deliberately and check who the file is shared with.
Tips
- The key never changes for a spreadsheet, even if you rename the file. Rename freely; your integrations will keep working.
- When you make a copy of a spreadsheet (File > Make a copy), the copy gets a new key. Update any tool that referenced the original.
- In Google Apps Script, you can fetch the key programmatically inside the spreadsheet's own script with
SpreadsheetApp.getActiveSpreadsheet().getId(). This is handy when you want to avoid manual copying. - Store keys you use often in a password manager or a private note, labeled with the spreadsheet name, so you do not have to hunt for URLs later.
- If a tool offers a "paste your Google Sheets URL" option instead of asking for the key, use it; the tool extracts the key for you.
Troubleshooting
- No "/d/" in the URL? You may be looking at a shared drive view, a preview, or the Sheets home page. Open the actual spreadsheet file so the full docs.google.com URL appears.
- The tool says the key is invalid. Copy it again carefully, making sure no spaces, slashes, or "edit" slipped in. Keys are case-sensitive, so if you typed it by hand, retype or re-copy it.
- The tool says it cannot access the spreadsheet. The key may be correct, but the account the tool connects with may lack permission. Check the file's sharing settings (click Share in the top right) and confirm the connecting account is allowed at least Viewer access, or that the sheet is shared as "anyone with the link" if your tool requires that.
- The URL looks different. Some older or regional URLs vary slightly, but the key always sits between /d/ and the next slash. If the link was shortened or redirected, open the file first and copy the URL from the address bar afterward.
- Integration broke after duplicating the sheet. A copy has a new key. Update the tool with the new key or point it back at the original spreadsheet.
Frequently Asked Questions
Is the spreadsheet key the same as the spreadsheet ID?
Yes. "Key," "ID" and "document key" all refer to the same string in the URL. Different tools use different names for it.
Is the spreadsheet key the same as the gid?
No. The key identifies the whole spreadsheet file; the gid (the number after #gid= in the URL) identifies one individual tab within it.
Does the key change if I rename the spreadsheet?
No. Renaming a file does not change its key. Only making a copy creates a new key, because the copy is a new file.
Is it safe to share my spreadsheet key?
The key alone does not grant access; sharing permissions still apply. But anyone with the key and existing access can open the file directly, so treat the key as semi-sensitive and avoid posting it publicly.
Can I get the key from the Google Sheets mobile app?
Not directly, since the app has no address bar. Use the app's share option to copy the file link, paste it into a note, and read the key from between /d/ and /edit.
Can I look up a spreadsheet by its key?
Yes. Paste https://docs.google.com/spreadsheets/d/ followed by the key into your browser to open that spreadsheet, as long as you are signed in to an account with access.