title: Using LinqToExcel to Create XML
body: <p>I'm trying to build an XML file from an Excel spreadsheet (no header row). This will be part of a service on a server, so I really don't want to use the MS Office PIO files. I found LinqToExcel on google and tried this code:</p>
  
  <pre><code>var clientExcel = new ExcelQueryFactory(excelFileName);
  var sourceXml = new XElement("rows",
    clientExcel.WorksheetNoHeader().Select(line =&gt; new XElement("row",
        line.Select((column, index) =&gt; new XElement("Column_" + index, column)))));
  </code></pre>
  
  <p>The code compiles, but at runtime I get a TargetInvocationException. I've worried at this for the better part of a day, but can't figure out where I've gone wrong. </p>
  
  <p>I'd appreciate it if someone would set me straight.</p>