Simple xlsx to DataTable example?

Oct 11, 2012 at 6:39 PM
Edited Oct 11, 2012 at 6:56 PM

I came across ClosedXML and have looked at your sample code.  Most of it seems directed towards creating xlsx files, but I understand it can read them also?

Do you have a code sample to simply read/parse the first worksheet of an excel file into a c# DataTable.

Oct 11, 2012 at 6:57 PM

Just loop through the range rows (foreach (var row in range.Rows()) and add the corresponding datarow to your datatable.

Oct 11, 2012 at 7:34 PM

Ok, thanks.