nacnudus / tidyxl

Read untidy Excel files in R https://nacnudus.github.io/tidyxl/
https://nacnudus.github.io/tidyxl/
Other
248 stars 21 forks source link

Read in openxlsx workbooks with xlsx_cells() #61

Closed nathanckuhn closed 4 years ago

nathanckuhn commented 4 years ago

Hello! Thank y'all so much for this excellent package! I have been using openxlsx heavily to create a complicatedly-formatted Excel document. I can do most everything I need with data frames and openxlsx, except I would like to easily reference the formatting of a particular cell & use that information to format a different cell. To do so I would need a decent reference table, and xlsx_cells() creates an excellent one! However, xlsx_cells() cannot read in the wb (Workbook) object created by openxlsx.

Would it be possible for xlsx_cells() and/or tidyxl in general to read in openxlsx workbook objects? They are essentially Excel document structures in R, so I would imagine it's possible, but I am still fairly new at programming and do not know how complicated that task would be.

That is a feature request -- at the same time, if anyone knows of a solution to my general problem in openxlsx, I would not mind any thoughts! (At the moment I'm trying to deconstruct your functions to create that xlsx_cells() table myself....)

Thank you!

nacnudus commented 4 years ago

Thank you for your kind words. It would be a lot of work to read in openxlsx workbook objects. Have you tried writing the openxlsx objects to disk first, and then reading them with tidyxl?

nathanckuhn commented 4 years ago

@nacnudus Yes, that would be the simplest option, thank you. However, it's not preferable with the code for that project. Sorry for the slow response, I haven't worked on that project in a while. Thank you for your thoughts. As I've gotten back into this project, I've tried to use openxlsx itself to create a large correlation table of all data and styles in an Excel. In doing so I've seen a lot of differences between their workbook object and the original coding of an Excel; so I imagine the coding for your two packages could be very different.

If I do figure out a similar table system for openxlsx, I'll try to post a link to it here :) Thanks again! I'll close this for now.