0

is it possible to write the code below with openxlsx package? im stuck at the createRow line as i think openxlsx doesnt have this function.

library(xlsx)


linkname = data.frame(fulllist=c("First","Second","Third","Fourth","Fifth"), hyplink=c("http://first.com/","http://second.com","http://third.com","http://fourth.com","http://fifth.com"),stringsAsFactors = F)

wb <- createWorkbook()
sheet1 <- createSheet(wb, "Sheet1")
rows <- createRow(sheet1, seq_along(linkname$hyplink))
rows <- createRow(sheet1, 1:5)
cells <- createCell(rows, colIndex=1:2) # 2 columns
for (i in seq_along(cells[,1])){
  col1 <- cells[[i,1]]
  setCellValue(col1, linkname$fulllist[i])
  addHyperlink(col1,linkname$hyplink[i])
  col2 <- cells[[i,2]]
  setCellValue(col2,linkname$fulllist[i])

}
saveWorkbook(wb, "C:/Users/K/Downloads/test.xlsx")
THOMAS K
  • 1
  • 1

0 Answers0