Forum Discussion
charles983
May 17, 2023Copper Contributor
Office scripts formulas auto updating other formulas
I am currently writing an excel script that populates a table. I am trying to add a hyperlink to one of the columns; however, when I add the hyperlink via a setValue or a setFormula function, the ver...
- May 19, 2023
charles983 Glad to hear that worked! You can specify the text to display like this:
table.getRange().getCell(i + 1, 3).setHyperlink({ address: "https://help.examplesite.com/tickets/" + jsonData[0][0][i]['ticket_id'], textToDisplay: "text here" })
Using multiple lines isn't necessary but it does help make the code more readable.
charles983
May 18, 2023Copper Contributor
Also, I am running this script through Power Automate.
MichelleRanMSFT
Microsoft
May 18, 2023charles983 here's the documentation for the setHyperlink method: ExcelScript.Range interface - Office Scripts | Microsoft Learn
You can try using it like this:
table.getRange().getCell(i + 1, 3).setHyperlink({ address: "https://help.examplesite.com/tickets/" + jsonData[0][0][i]['ticket_id'] })
Let me know if that helps or if you have any questions!
- charles983May 19, 2023Copper ContributorThat worked! Thank you so much.
- charles983May 19, 2023Copper ContributorAlso, I noticed there is a textToDisplay property that can be changed. What is the syntax for adding multiple properties, similar to how you added the address.
- MichelleRanMSFTMay 19, 2023
Microsoft
charles983 Glad to hear that worked! You can specify the text to display like this:
table.getRange().getCell(i + 1, 3).setHyperlink({ address: "https://help.examplesite.com/tickets/" + jsonData[0][0][i]['ticket_id'], textToDisplay: "text here" })
Using multiple lines isn't necessary but it does help make the code more readable.