How To Make A Key In Google Sheets

How to Make a Key in Google Sheets

In Google Sheets, a key is a unique identifier consisting of a long string of text, numbers, and other figures that references just charts all through the internet. That way, you can reference that particular sheet at any time or share it with other collaborative team members.

This key, also called the Sheets ID, is not customizable – it is given automatically by Google Sheets when you create a new one. However, most people don’t know how to get their key and how to use it, so we’ll show you how.

 

How to Get Your Google Sheets Key

1. The easiest way to get your Google Sheets key is through the URL bar. It should look something like this https://docs.google.com/spreadsheets/d/Neque porro quisquam est qui dolorem ipsum quia dolor sit amet/edit#gid=0, with the lipsum part showing where the key would be in an actual reference. Simply copy it from there and paste it where needed.

072020 2011 Howtomakeak2

2. If you would like to use the Spreadsheets key in a cell and do not mind a bit of coding, simple do the following:

Go to Tools -> Script editor

072020 2011 Howtomakeak3

The editor will open in a new window and automatically create a Code.gs with a template function in it. It looks something like this

function msc() {

return SpreadsheetApp.getActiveSpreadsheet().getId();

}

072020 2011 Howtomakeak4

3. Now just add =msc() wherever you want the key in your spreadsheet.

072020 2011 Howtomakeak5

4. Rename the function to something simple like msc (my script code), then Insert a return line and save.

That’s how to get your Google Sheets key. If you are referencing the sheet using the IMPORTRANGE function, you don’t need the key. By default, Sheets uses the key of the first open spreadsheet. However, it helps if you want to reference a different one.