ropensci / writexl

Portable, light-weight data frame to xlsx exporter for R
https://docs.ropensci.org/writexl
Other
210 stars 17 forks source link

supply name of sheet to be written to #23

Closed gulligull closed 6 years ago

gulligull commented 6 years ago

It wold be helpful to be able to name the sheet an output is written into (instead of having the default name "Sheet1".

Similar to openxlsx::write.xlsx(..., sheetName = "my_sheet_name")

rdatasculptor commented 6 years ago

I'm not sure if I understand your problem correctly, but maybe you are helped by a named list. If you put your data frame into a named list (like list(my_sheet_name=mydataframe)) and you write.xlsx() this list I guess you'll get the desired outcome.

gulligull commented 6 years ago

Ok, i guess that is what i want to do then. I will try it out. It also fits neatly in my data processing workflow with purrr. Thank you for your input, I appreaciate it!

Best, Patrick

Am 21. August 2018 um 09:59:38, rdatasculptor (notifications@github.com) schrieb:

I'm not sure if I understand your problem correctly, but maybe you are helped by a named list. If you put your data frame into a named list (like list(my_sheet_name=mydataframe) and you write.xlsx() thuis list I guess you'll get the desired outcome.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ropensci/writexl/issues/23#issuecomment-414586055, or mute the thread https://github.com/notifications/unsubscribe-auth/APz0h3T7fVjjOxsIhSTKahfQKd6rCA_lks5uS73qgaJpZM4WFNuW .

jeroen commented 6 years ago

You can indeed use a named list to write:

writexl::write_xlsx(list(mysheet = iris), "myfile.xlsx")