Cell index must be >= 0
See original GitHub issuevar excelData = mapper.Take<CustomNpoiModel>(mapper.Workbook.GetSheetAt(0).SheetName).Select(x => x.Value).ToList();
I have used this line in 10 different “Actions” and every single approach this mapping works great, but in my last action I got this strange exception which is “Cell index must be >= 0” and the error does not provide any additional information!
Strangely, I have tried to use an Excel File which I’ve created last week, and when I use that File, I didn’t get any errors, then I simply copy that Excel file and create a new one, and copy those rows into the new Excel File, and yet I got the same error.
Additional Information :
public class CustomNpoiModel
{
[Column("No")]
public int No { get; set; }
[Column("Name")]
public string Name { get; set; }
[Column("Path")]
public string Path { get; set; }
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
IllegalArgumentException when attempting to import XLSX ...
Exception: IllegalArgumentException: Cell index must be >= 0. Here's the solution that worked out for me: I copied the full data from the ......
Read more >ZFJ Importer Utility :Cell index must be >= 0 error
While using the importer utility , if one gets an error Cell index must be >= 0 , it may be because one...
Read more >Cell index must be >= 0 - [jXLS-user] Bug
[jXLS-user] Bug : Cell index must be >= 0. This error occurs when i have thick borders in my template file and when...
Read more >We are getting Cell index must be >= 0 error in Version 40.0
We are getting Cell index must be >= 0 error when we try to import the Excel file in Version 40.0.
Read more >jxls 1.0.6 bug: java.lang.IllegalArgumentException: Cell ...
IllegalArgumentException: Cell index must be >= 0 attachment is maven project source code. Full exception stack trace: java.lang.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
But I will include more error details for any exception during import.
ok, this property may mislead users to get the value after constructing a mapper. Actually it is initialized as -1 by design. The purpose of this property is to let user specify for the first row so the mapper can start to work from that row, even if there are non-blank rows above that index. for example you may have description rows at the beginning rows, and data rows just start after that.
If you set it as zero explicitly, means there is no header row, the first row is data row already. if mapper see it’s -1 then mapper will use default value
sheet.FirstRowNum
.I don’t see any issue with -1 as the default value, your exception may be related to the column index rather than the row index. Or may already been fixed 😃