Skip to content

Instantly share code, notes, and snippets.

@tamirko
Last active March 23, 2024 16:53
Show Gist options
  • Save tamirko/da69818c4ced9b71cff4ce236b9dd4bd to your computer and use it in GitHub Desktop.
Save tamirko/da69818c4ced9b71cff4ce236b9dd4bd to your computer and use it in GitHub Desktop.
How to go to a specific cell in a Google sheet ?
function onOpen()
{
var menuEntries = [{name: "Go to", functionName: "goToCell"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu("MyUtils", menuEntries);
}
function goToCell()
{
var strRange = Browser.inputBox("Insert the required cell (e.g.: B351):", Browser.Buttons.OK_CANCEL);
if(strRange != "cancel")
{
try
{
SpreadsheetApp.getActiveSheet().getRange(strRange).activate();
}
catch(e) {Browser.msgBox(e.message);}
}
}
@mordechaibod
Copy link

I have modified a dynamic excel hyperlink to the google sheets format. Clicking the link though the cell is specified does not go to that cell.
Do you think you can help me modify the code to go to the dynamic target.
the =IFERROR(HYPERLINK("https://docs.google.com/spreadsheets/d/1H8ipUCRMrzvFFvh1ARS5vB2G0W4JGKb9ybfFvxEMWGk/edit?pli=1#gid=2042944730"&ADDRESS(MATCH(A3,Activities!$B$1:$B$348,0),2,,,"Activities"),A3),"No Match")

@purarue
Copy link

purarue commented Dec 12, 2017

@mordechaibod
You can go to a specific cell using a hyperlink by adding &range={cell} after #gid={Sheet_ID}:
https://docs.google.com/spreadsheets/d/{Spreadsheet_ID}/edit#gid={Sheet_ID}&range=A100 would go to the cell A100 on the spreadsheet.

For Example: https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit#gid=0&range=A30

SpreadSheet ID distinguishes your spreadsheet, and Sheet ID's differentiate pages. More info on that here.

@tamirko
Copy link
Author

tamirko commented Jan 12, 2018

@TechNerdXp
Copy link

I need help to be able to jump to given row from stand-alone Google Apps Script or by visiting a link without page refresh like @seanbreckenridge's solution. I've got a chrome extension that injects a panel on top of the sheet and the extension can access the sheet through a standalone google apps script, now I want to jump to the variable row by clicking a button on that panel.
Capture

@TechNerdXp
Copy link

@AbeerJamal
Copy link

AbeerJamal commented Mar 31, 2019

Just adding some input, If we have to hyperlink the cell from a sheet within same workbook, we don't have to write complete link as mentioned above, Let me suggest two easy options here;

  1. wherever you want to create a link, just type =HYPERLINK("#rangeid=sheet ID","sheet name"), writing Sheet Name here means that you want this name to be shown in the Cell
    or
  2. just right click on any cell, click on Insert Link, and click on the sheet where you want the link, it will work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment