The first file below has an error when opening in Excel due to a quote that is not escaped. The second file works because the quote is escaped. I think that we should automatically escape any quotes in strings.
library(writexl)
df <- data.frame(website = xl_hyperlink("http://www.berkeley.edu", 'Berkeley "homepage'))
write_xlsx(df, 'test_error.xlsx')
df <- data.frame(website = xl_hyperlink("http://www.berkeley.edu", 'Berkeley ""homepage'))
write_xlsx(df, 'test_success.xlsx')
Created on 2025-09-15 with reprex v2.1.1