title: c# using excel file from embedded resource
body: <p>i'm writing a grading program for my girlfriend and i'm stuck trying to output the data to an excel file I embedded into the program. I have it writing to a blank excel file currently but would like to use a pre-made excel file and just export the data to the appropriate cells. I can't figure out how to tell the program to use the xls file in the resource folder instead of making a blank excel file. Here is the code for saving it so far. I'm using C# 2008 express edition.</p>
  
  <p>Thanks</p>
  
  <p>my rescource reference is: Properties.Resources.gradesheet</p>
  
  <pre><code>Excel.Application xlApp;
          Excel.Workbook xlWorkBook;            
          Excel.Worksheet xlWorkSheet;
  
          object misValue = System.Reflection.Missing.Value;
  
  
          xlApp = new Excel.ApplicationClass();
          xlWorkBook = xlApp.Workbooks.Add(misValue);
  
          xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
          //add data to excel
          xlWorkSheet.Cells[1, 1] = firstName;
          xlWorkSheet.Cells[2, 1] = lastName;
  
  
  
  
          xlWorkBook.Close(true, misValue, misValue);
          xlApp.Quit();
  
          releaseObject(xlWorkSheet);
          releaseObject(xlWorkBook);
          releaseObject(xlApp);
  </code></pre>