title: C# Convert csv to excel 2007
body: <p>I need to export the data of a report that can escalate to 300.000 rows to excel.</p>
  
  <p>For a high speed requirement, I used <a href="http://www.codeproject.com/Articles/25133/LINQ-to-CSV-library" rel="nofollow">this</a> library to create a csv file. The only problem I am having now, is that the column width is not adapted to the content of the widest cell, it gets cutted until I manually widen the column.</p>
  
  <p>I thought that maybe an option was to convert my csv file to an excel file, but I couldn't find a solution anywere! </p>
  
  <p>One option was using <strong>OpenXML</strong>, but at least what I know, is that it doesn't work for Excel 2007.</p>
  
  <p>Another option was to work with <strong>Interop</strong>, but it also has its problems.. when I try to create the Application object, it throws an exception: </p>
  
  <blockquote>
    <p><em>"Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following
    error: 80070005 Access is denied." (Exception from HRESULT: 0x80070005
    (E_ACCESSDENIED)).</em></p>
  </blockquote>
  
  <p>And the solutions I found can't be implemented on the client I am working on, for security reasons.</p>
  
  <p>I am running out of options..</p>
  
  <p>Thank you for your help!!!</p>