title: How to remove a column from excel sheet in epplus
body: <p>I'm using csharp to insert data into excel sheet into 7 columns. The interface of this program will allow users to select 7 checkboxes. If they select all 7, all the 7 columns in spreadhseet will have data, if they select one checkbox then only one column will have data. I have got a for loop which will check if data is there, if no data exists, I want to remove that column in epplus. Here's a previous discussion on this topic 
  <a href="https://stackoverflow.com/questions/14170717/how-can-i-delete-a-column-of-xlsx-file-with-epplus-in-web-app">How can I delete a Column of XLSX file with EPPlus in web app</a> 
  It's quiet old so I just wanna check if there's a way to do this.
  Or, is there a way to cast epplus excel sheet to microsoft interop excel sheet and perform some operations.</p>
  
  <p>Currently, I've code like this:</p>
  
  <pre><code>for(int j=1; j &lt;= 9; j++) //looping through columns
  {
  int flag = 0;
  for(int i = 3; i &lt;= 10; i++) // looping through rows
  {
      if(worksheet.cells[i, j].Text != "")
      {
          flag ++;
      }
  }
  if (flag == 0)
  {
       worksheet.column[j].hidden = true; // hiding the columns- want to  remove it
  }
  }
  </code></pre>
  
  <p>Can we do something like:</p>
  
  <pre><code>Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
  xlApp = worksheet; (where worksheet is epplus worksheet)
  </code></pre>