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

Support parsing rows to other data types than String[] #38

Open
mjiderhamn opened this issue Mar 2, 2017 · 3 comments
Open

Support parsing rows to other data types than String[] #38

mjiderhamn opened this issue Mar 2, 2017 · 3 comments

Comments

@mjiderhamn
Copy link

Columns in Excel files being batch processed may contain numbers or dates. Currently all rows are parsed into String[] (see Sheet line 47). spring-batch-excel interfaces should use generics to support other representations of a row, such as Object[].

@mksraja
Copy link

mksraja commented Jun 8, 2017

I am using this spring-batch-excel in our application, It is automatically converting the number fields with .0 to make it as number. Could you please let me know how to disable this auto conversion and let the RowMapper returns always string for all cloumns.

@mjiderhamn
Copy link
Author

If you've built spring-batch-excel from my pull request, have a look at the test cases to see how to still get String for all columns.

@mdeinum
Copy link
Collaborator

mdeinum commented Oct 26, 2021

The issue is that when using a streaming result the result is always a formatted cell value as a String. What would be the better solution is to make methods on the RowSet to get the value of a row as a specific type. Just like the SQL based SqlRowSet which has getLong, getDate for specific columns. That way you can get the specified result from the RowSet to use in the RowMapper.

For a classis PoiSheet we could use the underlying sheet/row to get the values (as you can get the value as is from the cell) for the StreamingSheet we would need to convert the String back to the specific type, for this we could use the Spring Framework ConversionService?

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

Successfully merging a pull request may close this issue.

4 participants