Reputation: 1672
I have a spreadsheet that have a column containing github issue numbers, how can I make all the fields in that column a url to the issue on github.
lets say https://github.com/myaccount/myrepo/issues/ is where the issues exist, I want to make all those fields link to "https://github.com/myaccount/myrepo/issues/{existing-issue-nb-here}"
Upvotes: 0
Views: 36
Reputation: 10786
If you never overwrite the first row of the column with the links you can use the HYPERLINK formula inside of an array formula
={"github issue #";
ARRAYFORMULA(IF(LEN(B2:B),
HYPERLINK("https://github.com/myaccount/myrepo/issues/" & B2:B,
B2:B), ""))}
If you are importing / copy pasting Column B and want to replace it with a link you need to do that with a script that, for every cell does
setFormula("=HYPERLINK(CONCATENATE(https://github.com/myaccount/myrepo/issues/ ,bugId), bugId)")
Where bug ID is either read from the row in column B or in the data you retrieved via script.
Upvotes: 1