I\'m wondering how can I export an r dataframe to excel format file, with some links embeded. So that I can use R to create an xlsm file. When open xlsm file, I can click ce
The xlsx
package has the function addHyperlink
, for exactly this purpose. example(addHyperlink)
should get you started.
The modern way is probably to use the openxlsx
package. See the documentation for ?makeHyperlinkString
as follows:
x <- c("https://www.google.com", "https://www.google.com.au")
names(x) <- c("google", "google Aus")
class(x) <- "hyperlink"
writeData(wb, sheet = 1, x = x, startCol = 10)