Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magic csv_to_wb() and csv_to_xlsx() functions? #93

Open
jmbarbone opened this issue Mar 16, 2022 · 2 comments
Open

magic csv_to_wb() and csv_to_xlsx() functions? #93

jmbarbone opened this issue Mar 16, 2022 · 2 comments
Labels
enhancement 😀 New feature or request

Comments

@jmbarbone
Copy link
Collaborator

Simple but would probably be pretty useful. I know I've saved many files as both csv and xlsx. A function that can can be passed a csv file (or files) that will convert it into an workbook and then another step for the xlsx. Probably don't need too many options (we'll have plenty of global options to control for a lot of areas) since this workflow is probably more oriented towards the "I should save these as an Excel file so coworkers can easily open them" instances.

Mock ups

csv_to_wb <- function(files, ...) {
  ls <- lapply(files, read.csv, ...)
  names(ls) <- names(files)
  wbWorkbook$new()$addWorksheet(ls)
}

Then we can have a nice converter.

csv_to_xlsx <- function(files, path, ...) {
  csv_to_wb(files, ...)$save(path = path)
}
@jmbarbone jmbarbone added the enhancement 😀 New feature or request label Mar 16, 2022
@JanMarvin
Copy link
Owner

This has the tendency to open a can of worms. "But I need read.csv2, why can't you add vroom or readr? What about fwf or completely haven? Can you add arrow and what about sqlite?" We can add a few of the ones you've mentioned, but if it gets out of hand, we might exclude them into a separate helper package.

@jmbarbone
Copy link
Collaborator Author

A fun = read.csv arg might suffice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 😀 New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants