Recently I stumbled over the task to read either CSV or Excel files and transfer data in an independent format to a server.
The existing software part implemented to similar approaches to
1. Read the file
2. Transfer the file into an intermediate format (a DataTable)
3. Transfer the file up to the server
The server took the file, read all data, translate number according to a given number format sent by the client, …
Reviewing the code resulted into a couple of drawbacks: redundant code, performance, use of language depending information on the server side, etc.
As a result I looked for an approach to
1. combine CSV and excel load within one flow and
2. have data translated on the client side into a format which can be read by the server without knowledge of the client user language (or the date format used for loading files)
Based on a code example for IDataReader (http://blogs.msdn.com/b/anthonybloesch/archive/2013/01/23/bulk-loading-data-with-idatareader-and-sqlbulkcopy.aspx) I had the idea to create a library which streams data independent of the input format.
Continue reading “Reading streamed data from Excel or CSV”