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

Feature request: export as excel format #430

Open
leeangling opened this issue Aug 4, 2022 · 8 comments
Open

Feature request: export as excel format #430

leeangling opened this issue Aug 4, 2022 · 8 comments

Comments

@leeangling
Copy link

is it possible to export as excel format? sometimes, the table is too wide to fit into word document. if the table can be saved into excel format, we don't need to worry about the column width and also we can be flexible in review the data in the table.

@kotliary
Copy link

kotliary commented Aug 4, 2022

Just came here to check for this feature as well.

@davidgohel
Copy link
Owner

This is a huge work and will not be available before a long time.

The data will be formatted: values are transformed into characters. I doubt we can reverse user-formats from R to Excel-formats, is it still wanted? For example, a column originally stored as numeric, will be stored in Excel as character; you will not be able to compute a mean on this column.

@leeangling
Copy link
Author

I don’t think it’s necessary to transfer the format for excel. We just need a more flexible file to present the data. With excel file, we can easily handle really wide tables and use excel functions to review the data. It should be fine if we can’t do the computation in excel. If it’s really needed, user can manually edit the format in excel.

@JanMarvin
Copy link

For reference, I once wrote a proof of concept function to do just that. Convert a flextable into a openxlsx2 workbook. It's a bit dated, "slow" and does not feature all flextables, but still does the trick.
JanMarvin/openxlsx2#445 (comment)

@davidgohel
Copy link
Owner

sorry @JanMarvin. We appreciate your suggestion to implement that feature, and we do have some existing drafts, for some features we will need to discuss with you. However, the implementation you provided doesn't quite meet our requirements (you can try it yourself, for example, with as_flextable(tabular(...))). Additionally, we are aware that you have submitted pull requests for 'mschart', and we understand the need to review them. Unfortunately, time is scarce for us at the moment, and we are uncertain when we will have the availability to thoroughly review all of your nice work.

@JanMarvin
Copy link

Hi @davidgohel, exactly, the list of what my proof-of-concept function can't do is still relatively long (it's above in the linked post), but nevertheless many of the less complex tables can already be converted to native xlsx variants along with the entire table layout. I had written the linked function at the time to have another use case for openxlsx2. However, without using flextable myself, which is why I would have to rely on e.g. your input for a better implementation. Currently it is nothing more than a proof that converting flextable objects into native xlsx worksheets is possible. I only wrote because I was reminded of the issue here last night via a StackOverflow post.

And with mschart, I fully understand and have absolutely no rush. My pull request works for my use case.

@pteridin
Copy link
Contributor

pteridin commented Aug 21, 2023

Here is my solution to this problem Package Link

It's my first run on this problem from a standalone package perspective and there is much work to be done. Still, better than nothing I guess.

Thanks to @JanMarvin for his inspirational work!

@davidgohel
Copy link
Owner

@pteridin sorry for the very late answer. This looks excellent. I just had a quick try, it works very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants