This project has moved. For the latest updates, please go here.

How to read two tables from Excel with C#?

Apr 29, 2014 at 11:28 AM
Edited Apr 29, 2014 at 11:36 AM
Hi all. I have an exercise, to create a program with C# Windows Form, which could convert TWO tables from Excel to a single XML document. I have been writing this problem in about 7 forums (for example:, but with no futher luck. But I get a comment, which advices me to use ClosedXML as my main library (I used pure OpenXML, which is very hard to learn and work with).

I was reading a documentation in here, but I didn't really get it, how to actually read two tables in Excel with C# using ClosedXML? My spreadhseet lokks like this:


I need to read those TWO tables in C#, and when, basically, convert them to XML file.

I was thinking that first of all I need to get the actual sheet ( var ws = wk.Worksheet("Sheet1"); ). When somehow I need to define the ranges for both tables (this is how I thinking but don't know how to actually do it).

So the question is how to read those two tables from Excel using C# ClosedXML library? Thank you.
Apr 29, 2014 at 3:34 PM
worksheet.Tables = collection of tables in the worksheet