C
C#11mo ago
talha.tahir

❔ What is default data types when reading from Excel sheet for upload into DB.?

I was trying to upload a excel sheet but having type miss match error while the data types in excel sheey are exactly same as in DB table. Is type conversion is required thus??
3 Replies
MarkPflug
MarkPflug11mo ago
How are you reading the Excel file? Excel worksheets don't inherently have a strongly-typed schema, so the fact that every value in your worksheet is correct for the target SQL table schema is likely not sufficient unless the library you are using can properly apply a schema mapping. I've authored some libraries for CSV and Excel that can handle this. Here is a code example using my CSV library: https://github.com/MarkPflug/Sylvan/blob/main/docs/Csv/Examples.md#bulk-load-csv-data-into-sqlserver And the same pattern can be applied using the Sylvan.Data.Excel library: https://github.com/MarkPflug/Sylvan.Data.Excel
GitHub
GitHub - MarkPflug/Sylvan.Data.Excel: The fastest .NET library for ...
The fastest .NET library for reading Excel data files. - GitHub - MarkPflug/Sylvan.Data.Excel: The fastest .NET library for reading Excel data files.
GitHub
Sylvan/docs/Csv/Examples.md at main · MarkPflug/Sylvan
A collection of .NET libraries, including the fastest general-purpose CSV parser for .NET. - MarkPflug/Sylvan
Florian Voß
Florian Voß11mo ago
are you using c# code for this? Share some of that. the types in your c# code are interesting for us and how you update the DB with the data you read from excel
Accord
Accord11mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.