How to create hyperlink to range in Google Sheets App Script?

后端 未结 4 724
忘了有多久
忘了有多久 2020-12-10 09:39

I\'m trying to fill cells with hyperlinks to ranges in Google Sheets app script with the same desired outcome I would get had I done it in GUI. I managed to create hyperlink

4条回答
  •  温柔的废话
    2020-12-10 10:06

    In case you want to create a link to another sheet which will open the sheet in the same browser tab here is what you want to do: 1. Get the id of the sheet. Check the link in your browser and you will see #gid=x where x is the sheet id 2. Then you want to set the formula (hyperlink) to the cell and make it show as a hyperlink SpreadsheetApp.getActiveSheet().getRange("A1").setFormula('=HYPERLINK("#gid=X","test")').setShowHyperlink(true); If you don't use setShowHyperlink(true) it will be shown as a regular text.

提交回复
热议问题