fsprojects / ExcelProvider

This library is for the .NET platform implementing a Excel type provider.
http://fsprojects.github.io/ExcelProvider/
The Unlicense
141 stars 51 forks source link

Add more information to exception if a cast fails while reading data #59

Closed theprash closed 6 years ago

theprash commented 6 years ago

Currently, if there is an Excel cell with an unexpected type a cast exception is thrown but there is no indication which column or row contains the problem cell. I've made a change to catch the exception and throw a new exception with more details, e.g.:

System.InvalidCastException : ExcelProvider: Cannot cast 'System.String' to 'System.Double'.
File: 'C:\blah.xlsx'. Sheet: ''
Column 'Float'. Row 1.

Feedback welcome.