title: How to iterate through Excel Worksheets only extracting data from specific columns
body: <p>How do you iterate through an excel workbook with multiple worksheets only extracting data from say columns "C", "E" &amp; "F"?</p>
  
  <p>Here is the code I have thus far:</p>
  
  <pre><code>public static string ExtractData(string filePath)
      {
          Excel.Application excelApp = new Excel.Application();
          Excel.Workbook workBook = excelApp.Workbooks.Open(filePath);
  
          string data = string.Empty;
  
          int i = 0;
          foreach (Excel.Worksheet sheet in workBook.Worksheets)
          {
              data += "*******   Sheet " + i++.ToString() + "   ********\n";
  
              //foreach (Excel.Range row in sheet.UsedRange.Rows)
              //{
              //    data += row.Range["C"].Value.ToString();
              //}
  
              foreach (Excel.Range row in sheet.UsedRange.Rows)
              {
                  foreach (Excel.Range cell in row.Columns)
                  {
                      data += cell.Value + "   ";
                  }
                  data += "\n";
              }
          }
  
          excelApp.Quit();
  
          return data;
      }
  </code></pre>
  
  <p>Thank you very much for your time, any help is appreciated.</p>