in_excel() needs a Mac OS version of shell.exec(). Below is a quick and dirty solution that worked for opening a .csv file on Candace's Macbook pro M3, Mac OS 14.5 Sonoma.
in_excel_mac <-
function (df, name, na = "")
{
csv_dir <- file.path(tempdir(), "csv")
if (!dir.exists(csv_dir)) {
dir.create(csv_dir)
}
if (missing(name)) {
csv_path <- tempfile(tmpdir = csv_dir, fileext = ".csv")
}
else {
csv_path <- file.path(csv_dir, paste0(name, ".csv"))
}
readr::write_excel_csv(df, csv_path, na = na)
system2("open", csv_path)
}
in_excel() needs a Mac OS version of shell.exec(). Below is a quick and dirty solution that worked for opening a .csv file on Candace's Macbook pro M3, Mac OS 14.5 Sonoma.