Hyperlink to a specific sheet

后端 未结 6 2044
猫巷女王i
猫巷女王i 2021-02-08 01:45

I would like to open a specific sheet of a Google Sheets from a hyperlink in another spreadsheet.

I have different links in my master spreadsheet and each should have a

6条回答
  •  耶瑟儿~
    2021-02-08 02:35

    Alternatively, you can try creating a custom function. With the spreadsheet open, click the Tools menu, then Script editor.... Paste the code into the editor:

    /**
     * Gets the Sheet ID from Sheet Name
     *
     * @param {string} input The Sheet Name
     * @return The Sheet ID
     * @customfunction
     */
    function SHEETID(input) {
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var tab = ss.getSheetByName(input);
      return tab.getSheetId();
    }
    

    Save, refresh the spreadsheet, and then type in your custom function

    =SHEETID("Your Custom Sheet Name")
    
    =SHEETID(A1)
    

    And voila! The unique ID for the tab (in the current spreadsheet) is output. You can hyperlink to it by using the following formula:

    =HYPERLINK("#gid="&SHEETID(A1),"Link")
    

提交回复
热议问题