title: Read excel table data using c#
body: <p>I have excel file with several excel tables. I want to read all the data in <strong>excel tables</strong> for a given excel sheet and copy those to a different excel table.
  One excel sheet may have several tables</p>
  
  <p>I have done that through VBA. I want to find a C# code to achieve it.
  This is the VBA code I used.</p>
  
  <pre><code>Dim tableObject As ListObject
  Dim oLastRow As ListRow
  Dim srcRow As Range
  
  Set sheet = ThisWorkbook.Worksheets("Sheet1")
  For Each tableObject In sheet.ListObjects
  Set srcRow = tableObject.DataBodyRange
  Set oLastRow = Worksheets("Sheet2").ListObjects("table1").ListRows.Add
  srcRow.Copy
  oLastRow.Range.PasteSpecial xlPasteValues
  Next
  </code></pre>