title: Convert .xlsx to .csv in asp net c#
body: <p>I need convert the xlsx file to csv file and I have tried this article:
  <a href="http://www.codeproject.com/Articles/246772/Convert-xlsx-xls-to-csv" rel="nofollow">http://www.codeproject.com/Articles/246772/Convert-xlsx-xls-to-csv</a></p>
  
  <p>The project works on ExcelDataReader library.</p>
  
  <p>In local debug F5 with visual studio I don't have error and the conversion is worked, but If launch the aspx page on the server I have this error:</p>
  
  <pre><code>Compiler Error Message: CS0246: The type or namespace name 'Excel' could not be found (are you missing a using directive or an assembly reference?)
  
  Source Error:        
  
  Line 16:         FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
  Line 17: 
  Line 18:         Excel.IExcelDataReader excelReader = Excel.ExcelReaderFactory.CreateOpenXmlReader(stream);
  Line 19:         DataSet result = excelReader.AsDataSet();
  Line 20:         excelReader.Close();
  </code></pre>
  
  <p>What am I missing?</p>
  
  <p>What's wrong with this code?</p>
  
  <p>Thank you in advance.</p>
  
  <pre><code>using System;
  using System.Data;
  using System.IO;
  
  public partial class Default2 : System.Web.UI.Page
  {
      DataSet result = new DataSet();
      string filePath = @"\\...\Tbl.xlsx";
  
      protected void UploadButton_Click(object sender, EventArgs e)
      {
      }
  
      protected void Page_Load(object sender, EventArgs e)
      {
          FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
  
          Excel.IExcelDataReader excelReader = Excel.ExcelReaderFactory.CreateOpenXmlReader(stream);
          DataSet result = excelReader.AsDataSet();
          excelReader.Close();
  
          result.Tables[0].TableName.ToString();
  
          string csvData = "";
          int row_no = 0;
          int ind = 0;
  
          while (row_no &lt; result.Tables[ind].Rows.Count)
          {
              for (int i = 0; i &lt; result.Tables[ind].Columns.Count; i++)
              {
                  csvData += result.Tables[ind].Rows[row_no][i].ToString() + ",";
              }
              row_no++;
              csvData += "\n";
          }
  
          string output = @"\\...\target.csv";
          StreamWriter csv = new StreamWriter(@output, false);
          csv.Write(csvData);
          csv.Close();
      }
  }
  </code></pre>