Wednesday, July 16, 2014

Using OpenXML to load an Excel Worksheet into a DataTable (or just how different OpenXML is from the old Excel API we're used too)

dotnet thoughts - Read Excel as DataTable using OpenXML and C#

In the current project we were using OpenXML extensively for reading Excel files. Here is the code snippet, which will help you to read / convert Excel files to DataTable.

image

..."

You've heard me whine about how, while OpenXML is cool and how nice it is that we can access Office 2007+ files without Office or third party apps, yet the API is pretty darn different for traditional Office Object Model users? This screenshot shows why... Parts, SharedStringTables, oh my... It's not hard, just takes a while to wrap your head around.

No comments: