Skip to contents

Create special column types to write to a spreadsheet

Usage

xl_formula(x)

xl_hyperlink(url, name = NULL)

Arguments

x

character vector to be interpreted as formula

url

character vector of URLs

name

character vector of friendly names

Examples

df <- data.frame(
  name = c("UCLA", "Berkeley", "Jeroen"),
  founded = c(1919, 1868, 2030),
  website = xl_hyperlink(c("http://www.ucla.edu", "http://www.berkeley.edu", NA), "homepage")
)
df$age <- xl_formula('=(YEAR(TODAY()) - INDIRECT("B" & ROW()))')
write_xlsx(df, 'universities.xlsx')

# cleanup
unlink('universities.xlsx')