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

Added support for writing XLSX #99

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

henka-rl
Copy link

@henka-rl henka-rl commented Dec 6, 2021

No description provided.

@jam01
Copy link
Contributor

jam01 commented Dec 7, 2021

Thanks @henka-rl I'll take a closer look, but this is a great addition.

Would it be possible to support reading as well?

Only thing so far is that we support input streams for reading, and output streams for writing, so we'll need to address that.

@henka-rl
Copy link
Author

henka-rl commented Dec 7, 2021

The library I found for XLSX only supports writing and in my current project we don't have a requirement for reading XLSX so at the moment I don't have any time for implementing reading unfortunately.

Regarding OutputStream for writing in the other FormatPlugins. The OutputStream is created inside the write method and at least in Camel (where I use Datasonnet) this OutputStream can't be handled. But in DefaultXLSXFormatPlugin I return an InputStream containing what has been written to the OutputStream and this works well in Camel.

@jam01
Copy link
Contributor

jam01 commented Dec 11, 2021

Camel will take care of converting from one type of stream to another. In general we'll need to change this to OutputStream, which is not a big change. However, right now I'm a little more interested in the implications of using this sett4 library. It's not hosted in maven central and doesn't seem very widely used. Perhaps we can use Apache POI directly, or bring in some of this code into datasonnet-mapper since it's also Aapahce 2.

@henka-rl
Copy link
Author

I've tried using the OutputStream from Datasonnet in Camel and it fails. I don't see how you ever could read from an Outputstream.
The sett4 library was the only Jackson implementation I found for XLSX and as it builds on CsvMapper it was easy to implement it in Datasonnet as I just (more or less) needed to copy DefaultCSVFormatPlugin. This library isn't perfect. It lacks support for reading and you can't set the name of the sheet. But it solved the requirement I had...

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

Successfully merging this pull request may close these issues.

2 participants