I was not able to get this to work as I always receive an error on prop.setValue(obj, Convert.ChangeType(val,type) - The error was Invalid Cast Exception Object must implement IConvertible. Indexes, values and Property types were all found but I could not see the issue on this line. Any ideas on what could be happening?
@ducna0610 Жыл бұрын
You can use: prop.SetValue( obj, TypeDescriptor.GetConverter((Type)type) .ConvertFromInvariantString(val.ToString()) );
@rutujakodlinge967611 ай бұрын
I'm facing same issue.. can someone please suggest the solution..
@Taimastavern10 ай бұрын
@@rutujakodlinge9676 anyone fix this? same
@ukaszczyz29629 ай бұрын
Same for me
@CarbonFanatic8 ай бұрын
same issue
@anhtuanpham291 Жыл бұрын
How to process if value of Cell is enum !
@roshankj4243 Жыл бұрын
My excel columns contains spaces between names i need to change my import function? Rest all same?
@gautammokal Жыл бұрын
Thanks for watching the video. Please see if this helps kzbin.info/www/bejne/aHKvZ5lpoLqAo5Y
@rajubro7445 Жыл бұрын
Is it open source? I am unable to install in package manager console
@nishathakur9942 жыл бұрын
My column names in excel sheet have spaces, how to write properties for that
@gautammokal2 жыл бұрын
Mapping excel fields with object properties can help. Here is a video on it kzbin.info/www/bejne/aHKvZ5lpoLqAo5Y Thanks
@nishathakur9942 жыл бұрын
@@gautammokal thankyou, does it work for. Xlsx excel file too?
@TurgayTuerk2 жыл бұрын
Alternatively you can use the 'DisplayName' attribute for your properties and access them by the 'CustomAttribute' reflection property of PropertyInfo.
@ghullaq3 жыл бұрын
Will this work if column names in Excel file do not match the names of fields in your classes?
@gautammokal3 жыл бұрын
It will not work. We can add mappings for column names and fields. Thanks for watching this video.
@gautammokal3 жыл бұрын
Just uploaded a new video. kzbin.info/www/bejne/aHKvZ5lpoLqAo5Y This shows how to use mappings while importing CSV data. Same logic will help in case of Excel import.
@ghullaq3 жыл бұрын
@@gautammokal Awesome! Thanks for taking time and letting me know!
@anhtuanpham291 Жыл бұрын
Anyone try with 1.000 rows ?
@gonzalomoraga2781 Жыл бұрын
Yes i do. It works fine. But i can´t use the lastest version of ClosedXML.