ExcelMapper | Map POCO objects to Excel files | JSON Processing library
kandi X-RAY | ExcelMapper Summary
kandi X-RAY | ExcelMapper Summary
A library to map POCO objects to Excel files.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ExcelMapper
ExcelMapper Key Features
ExcelMapper Examples and Code Snippets
Community Discussions
Trending Discussions on ExcelMapper
QUESTION
Reading an excel file containing financial data and mapping it to an object using ExcelMapper.
...ANSWER
Answered 2020-Jul-04 at 06:41After raising the issue with the creator of ExcelMapper, Michael Ganss; he said (link) -
If the mapping doesn't generate any errors I would probably handle this with a classic
.Where()
(or.TakeWhile()
). Otherwise you can try and use the custom mapping methods to avoid any errors and then filter.If you do know the range of rows in advance you can use the data row range properties.
I was hoping there was an in-built way to handle rows with incorrect types to avoid performance drop (over 100000 rows) due to filtering after capturing all data points, but this is still the quickest library with a readable code compared to other libraries.
QUESTION
I'm using Apache POI to read data from an Excel spreadsheet and sending a POST to a remote service.
While testing my implementation I found out it blew up with an exception when my method tried to parse an empty string into a BigDecimal. I discovered this is due to the fact that, according to the Apache POI documentation, getLastRowNum() may
rows which had content before and were set to empty later might still be counted as rows by Excel and Apache POI, so the result of this method will include such rows and thus the returned value might be higher than expected!
And lo and behold, it did return a bigger number than I had initially anticipated, forcing me to use the value in the first cell in the row as the exit condition for my loop, something like the following:
...ANSWER
Answered 2020-Apr-04 at 18:46Promoting a comment to an answer...
Excel files are generally stored "sparse" so with gaps for rows with no data in. So, any row in an Excel file you read back with Apache POI could be null. Equally, a row could be styled but have no data in, which means you'd get it back if you asked for it, but without values as you might expect.
So, for your case, you probably want to start at the last row, and work backwards. For each row, check if it is null. If it isn't null, grab a few cells, being aware that those could be null too! Check those, and if enough is present/valid, consider that the "last valid row". If not, go one row higher. Repeat until you find something you consider valid!
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ExcelMapper
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page