67

One can link to a Google Sheets via key, and via key and worksheet id:

  • https://docs.google.com/spreadsheet/ccc?key=SOME_KEY
  • https://docs.google.com/spreadsheet/ccc?key=SOME_KEY#gid=WORKSHEET_ID

Is it also possible to link to a certain row or even cell via URL query parameters or fragments?

Similar to the anchor link mechanism in HTML?

pnuts
  • 17,883
  • 5
  • 55
  • 103
miku
  • 1,896
  • 2
  • 16
  • 20

5 Answers5

52

Cells And Ranges

Please try:

https://docs.google.com/spreadsheets/d/13PuCx8zKUjXvofFYBGzoOYog7UHpvLzCgxMLF9INnr8/edit#gid=0&range=D10

Shorten version for the internal use in Spreadsheet:

#gid=0&range=D10

#gid=0&range=D10:E22

right click any cell and try get link to this cell

enter image description here

Named Ranges

You may also create a named range, and use UI to create a link to this range:

Insert > Link

And select a link to your named range. If you copy the link text, you'll get this:

https://docs.google.com/spreadsheets/d/xxxxx/edit#rangeid=yyyyy

I'm sorry, but at the moment I see no way to get the link to named range programmatically, please see this question for more info.

Max Makhrov
  • 475
  • 8
  • 16
18

As another user answered, Google finally added a feature to Google Sheets (GS) spreadsheets to allow linking directly to cells. The feature is intended for linking to ranges of cells, but specifying single cells works, too. GS also supports linking to named ranges of cells in a spreadsheet, but that feature requires a little more work to use than the range of cells by address feature. The extra effort may be worthwhile, though.

Note:

  • A random spreadsheet is used for the examples below.
  • Google Docs URLs usually include /edit immediately after the long document ID string. Those are annoying, because they take up space and they're unnecessary. If the URL doesn't include /edit, Google Docs will usually open the document in edit mode anyway. They've been left out of the URLs in the examples below.

Link to: A single cell in a sheet

  1. Click on the spreadsheet cell to be referenced. For example, cell C7.
  2. Open the contextual menu (using secondary click: right-click, ctrl-click, etc.).
  3. Scroll down the menu and click on the "Get link to this cell" item. The message "The link has been copied to the clipboard" will be shown.
  4. Paste the link's URL from the clipboard anywhere it's needed. It will be similar to:

    https://docs.google.com/spreadsheets/d/1yk6W3iyZM7JKffsRTjPhm9I_PWerrJbltoHZ37Tqdh0#gid=2021414981&range=C7

Some things to notice about the arguments contained in the fragment identifier of this URL:

  1. gid= – This is the ID of a sheet in the spreadsheet. New spreadsheets have one sheet with the ID 0. The ID of the currently visible sheet is usually shown in the browser's URL bar.
  2. range= – This is the address of the referenced cell, in "A1 format" (column letter and cell number).

The contextual menu seems to be the only way in the GS UI to get cell URLs. There aren't any other menu items that do this.

Link to: A range of cells in a sheet

  1. Highlight a range of spreadsheet cells to be referenced. For example, cells C7 through D13.
  2. Open the contextual menu.
  3. Scroll down the menu and click on the "Get link to this range" item. The message "The link has been copied to the clipboard" will be shown.
  4. Paste the link's URL from the clipboard anywhere it's needed. It will be similar to:

    https://docs.google.com/spreadsheets/d/1yk6W3iyZM7JKffsRTjPhm9I_PWerrJbltoHZ37Tqdh0#gid=2021414981&range=C7:D13

Note: To select a group of non-empty, contiguous cells in a sheet, click on one cell in the group, then press the "select all" keyboard shortcut (command-A, ctrl-A, etc.). Depending on the contents of the nearby cells, either a range of cells or all cells in the sheet will be selected. For example, in cell C7 of the example spreadsheet, this method selected cells in the range A1:K28.

Link to: All cells in a sheet

In this and the following sections, instructions for getting the URL are abbreviated. Only the first step, the selection of cells, is described. See the previous section for detailed instructions.

On the box to the left of column letter "A" and row number "1", open the contextual menu, then click on the "Get link to this range" item.

The URL will be similar to:

https://docs.google.com/spreadsheets/d/1yk6W3iyZM7JKffsRTjPhm9I_PWerrJbltoHZ37Tqdh0#gid=2021414981&range=1:605

Note that the range is only row numbers, starting with 1 and going to the highest row number. When a range of only row numbers is given, all columns within those rows are included in the range.

Link to: Range of either columns or rows

Select one or more column letter or row number labels.

The URL will be similar to:

Link to: A named range

Linking to a named range is trickier than getting the link to a range of cells by address. GS doesn't have a feature to link directly to the named range. Using the name of a named range in the range= argument doesn't work. Follow these steps to get a working link URL for a named range:

  1. Be sure the spreadsheet has a named range in it. If it doesn't, create one. (E.g., in the example spreadsheet, the range named "judgenames" was defined as "C1:C", which GS saves as "C1:C605".)
  2. Click on an empty cell of the spreadsheet.
  3. Use the "Insert link" feature (i.e., from the Insert > Link... menu item, from the "Insert link" contextual menu item, the keyboard shortcut command-K or ctrl-K, etc.).
  4. In the link editor box that appears, click "Named ranges in this spreadsheet", then click the name of a range shown below it (e.g., "judgenames")
  5. Click the "Apply" button.
  6. Move the pointer over the new link. A popup showing part of the URL will appear (e.g., #rangeid=1332253898).
  7. Copy that new link from the popup by either:

    1. Copying the link text and using it in place of the fragment identifier in the URL of the current spreadsheet.
    2. Copy the link address. (The wording used by Google Chrome.)

    These methods will vary from browser to browser.

The URL will be similar to:

https://docs.google.com/spreadsheets/d/1yk6W3iyZM7JKffsRTjPhm9I_PWerrJbltoHZ37Tqdh0#rangeid=1332253898

Some things to notice about the arguments contained in the fragment identifier of this URL:

  1. rangeid= – This argument is used instead of the range= one found in links to a range of cell addresses.
  2. gid= - This argument isn't used. That's probably because the ID of a named range is sufficient to specify both a sheet ID and a range of its cells.

Why is it worth the effort to use a named range?

When a URL refers to a GS named range, the spreadsheet will open and focus will be placed on whichever cell range the named range refers at the present time. When the "judgenames" range was originally defined, it was for the range "C1:C605", which will receive focus when the spreadsheet is opened. However, imagine the "judgenames" range is redefined, to say "D1:D5". The next time this same URL is used to open the spreadsheet, the new range will receive focus, not the old one.

Link to: A sheet

Finally, the simplest link of all, a specific sheet in a spreadsheet. The simplest way to get this is to select a sheet in the spreadsheet, then copy the URL from the address bar of the web browser.

The URL for a sheet is similar to that of a cell range. It only lacks the range= argument of the fragment identifier:

https://docs.google.com/spreadsheets/d/1yk6W3iyZM7JKffsRTjPhm9I_PWerrJbltoHZ37Tqdh0#gid=583749522

Linking to a nonexistent sheet will usually cause GS to open the default sheet of the spreadsheet, the first sheet.

17

Notes:

*Spreadsheets created in the old version of Sheets will eventually be converted to the new Sheets, which won’t require any action on your part. More details coming soon.


Yes, it is possible to link to a row by using the following link.

Link

https://docs.google.com/spreadsheet/lv?
  key={your_key}&                // spreadsheet key
  type=view&                     // view (list under menu view)
  gid=0&                         // sheet number
  f=true&                        // markup parameter
  sortcolid=-1&                  // sort parameter
  sortasc=true&                  // sort parameter (asc/desc)
  page=4&                        // row to edit (counts for 5)
  rowsperpage=1                  // number of rows per page (needs to be n=1)

Screenshot

enter image description here

Example

The following link opens the file, created in this answer, and catches the 5th row: example link

Reference

Blogpost:
http://mashe.hawksey.info/2013/07/how-to-open-a-google-spreadsheet-at-a-specific-row-for-editing/

Martin Hawksey:
is an active blogger, predominantly writing about Google Apps Scripts in combination with Google Spreadsheets. See his blog for more interesting stuff or follow him on Google+.

Jacob Jan
  • 23,322
  • 16
  • 106
  • 195
6

One workaround is to add a comment to the cell. In the comment write +email-address, for e.g. "This comment is to link to the cell for +me@emailaddress.com".

"Me@emailadress.com" will then receive an email with a link, that if you click it, will automatically highlight that particular cell+comment in the spreadsheet.

I'm not sure, but you theoretically ought to be able to share that link with others who have access to the spreadsheet and the cell should highlight for them as well.

Veesh
  • 61
  • 1
  • 1
1

Another common use case is that you want to link to a particular cell/range, but the data may be sorted, added and filtered and your reference will be lost. You can work around this by creating a view and linking within a view. Steps:

  1. Create a new view that you would like to use. Remove all filters and sorts (or set some default sequential sort where data can't be inserted).
  2. On the sheet, right click on the cell/range that you would link to and click on "Get link to this cell/range" menu. Paste this value somewhere, like in Notepad.
  3. Look at the URL and get the View ID from the address, usually at the end, that looks like &fvid=32010312357 or some other number. Paste this value at the end of the link that we got in the previous step
  4. Your link should now look like this: https://docs.google.com/spreadsheets/d/[SHEET_ID]/edit#gid=0&range=A40:H40&fvid=[VIEW_ID]