Spreadsheet Parser in Java/Groovy

2019-05-08 19:10发布

Hi I'm looking to parse spreadsheets (xls/ods) in Groovy. I have been using the Roo library for Ruby and was looking to try the same tasks in Groovy, as Java is already installed on a development server I use, and I would like to keep the number of technologies on the server to a simple core few.

I am aware that the ods format is zipped XML, and so can be parsed as such, but I would like to process the file using spreadsheet concepts, not XML concepts.

The ability to process xls files is not of major importance, but would save me having to save multiple xls files to ods (as this is for parsing data from clients).

Thanks

8条回答
Evening l夕情丶
2楼-- · 2019-05-08 19:34

I would suggest Apache POI for access to .xls files.

I've never had to work with the .ods format, so no information on that one.

查看更多
不美不萌又怎样
3楼-- · 2019-05-08 19:38

I second jdmichal's vote for Apache POI. I have selected it as our library of choose to handle Excel file input (.XLS). The project is also working on the .XLSX file format if you ever decide you want to support that. Based on your specifications, I don't think you want to get into converting things into CSV and it seems like you have established input and output paths. For anyone who hasn't had the joy of dealing with CSV to Excel conversion, it can get a bit dicey. I have spent hours dealing with issues created by Excel converting string data to numeric data. You can see other testimonies to this effect on the POI Case Studies page. Beyond these issues, I simply don't want to personally have to handle these inputs. I'd rather invest the programming effort and streamline the workflow for the future.

I too have not dealt with ODF and have no plans to support it in my current project. You might want to check out the OpenOffice.org ODF Toolkit Project.

Good luck and have fun, - D.

查看更多
登录 后发表回答