How do I stop writing an excel file if the file already exists and instead get a message?
For example, if the mtcars-data.xlsx
file already exists in the data folder, I do not want to run the following code. Instead, I would like to have this message "mtcars-data.xlsx already exists".
library(writexl)
df <- mtcars
writexl::write_xlsx(df, "data/mtcars-data.xlsx")