Skip to content

Writing hyperlink formula after upgrading to version 4.2.4 #200

@kbzsl

Description

@kbzsl

Describe the bug
I found an issue when writing an hyperlink formula (writeFormula) after upgrading the openxlsx from 4.2.3 -> 4.2.4.

To Reproduce
Here is an example code:

library(dplyr)
library(openxlsx)

channels <- tribble(
  ~channel, ~homepage,
  "ABC", "https://www.abc.net.au/",
  "BBC", "https://www.bbc.com/",
  "CBC", "https://www.cbc.ca/"
)

channels <- channels |> 
  mutate(formula = paste0(
    '=HYPERLINK("', 
    homepage, 
    '", "', 
    channel, 
    '")')
  )

wb <- createWorkbook()
addWorksheet(wb, "channels")
writeDataTable(wb, "channels", channels, tableName = "channels")
writeFormula(wb, "channels", channels$formula, startRow = 2, startCol = 1)
freezePane(wb, "channels", firstRow = TRUE)
setColWidths(wb, "channels", cols = 1:ncol(channels), widths = "auto")
saveWorkbook(wb, file = here::here("temp",  "channels.xlsx"), overwrite = TRUE)

Screenshots

screenshot when using 4.2.3 (desired outcome):

openxlsx_4 2 3

screenshot when using 4.2.4

openxlsx_4 2 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions