title: Export table object to CSV
body: <p>We extracted the required tables from word doc, but can someone help... that how can I export this table object <code>$LETable</code> to CSV, or export values which we have fetched below in CSV in table format.</p>
  
  <pre><code>$objWord = New-Object -Com Word.Application
  $filename = 'D:\Files\Scan1.doc'
  $objDocument = $objWord.Documents.Open($filename)
  
  $LETable = $objDocument.Tables.Item(4)
  $LETableCols = $LETable.Columns.Count
  $LETableRows = $LETable.Rows.Count
  
  $obj = New-Object -TypeName PSCustomObject
  
  Write-Output "Starting to write... "
  
  for($r=1; $r -le $LETableRows; $r++) {
      for($c=1; $c -le $LETableCols; $c++) {
          #Write-Host $r "x" $c
          $content = $LETable.Cell($r,$c).Range.Text
          Write-Host $content
      }
  }
  $objDocument.Close()
  $objWord.Quit()
  # Stop Winword Process
  $rc = [System.Runtime.Interopservices.Marshal]::ReleaseComObject($objWord)
  </code></pre>