This project has moved and is read-only. For the latest updates, please go here.

Simple xlsx to DataTable example?

Oct 11, 2012 at 7:39 PM
Edited Oct 11, 2012 at 7: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 7: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 8:34 PM

Ok, thanks.