spring-batch-extensions icon indicating copy to clipboard operation
spring-batch-extensions copied to clipboard

Support parsing rows to other data types than String[]

Open mjiderhamn opened this issue 7 years ago • 3 comments

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[].

mjiderhamn avatar Mar 02 '17 09:03 mjiderhamn

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.

mksraja avatar Jun 08 '17 19:06 mksraja

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.

mjiderhamn avatar Jun 11 '17 14:06 mjiderhamn

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?

mdeinum avatar Oct 26 '21 09:10 mdeinum