Question: I can't seem to create a new blank excel file so I can write in it with excel Interop later

```
 System.IO.FileStream fs =(System.IO.FileStream)saveFileDialog1.OpenFile();
 switch (saveFileDialog1.FilterIndex)
 {
     case 1:
         //write blank xlsx?
         break;
     case 2:
         //write blank xls?
         break;
 }
 fs.Close();
 ExportDataSetToExcel(_destinationDataSet, saveFileDialog1.FileName);

```

If I pass an empty file I got this error

> 
> Cant open file because the file format or file extension is not valid.
>  Verify that the file has not been corrupted and that the file
>  extension matches the format of the file.
> 
> 
> 

So.. How can I create an empty xls or xls file?

Answer: 
Simplest way

```
var app = new Microsoft.Office.Interop.Excel.Application();
var wb = app.Workbooks.Add();
wb.SaveAs("File Path.xlsx");
wb.Close();

```
I ended up doing this...

```
if (saveFileDialog1.FileName != "")
    {
      var app = new Application();
      var wb = app.Workbooks.Add();
      switch (saveFileDialog1.FilterIndex)
         {
            case 1:
               wb.SaveAs(saveFileDialog1.FileName);
               break;    
            case 2:
               wb.SaveAs(saveFileDialog1.FileName, XlFileFormat.xlExcel8);
                        break;
         }
      wb.Close();
      app.Quit();

      ExportDataSetToExcel(_destinationDataSet, saveFileDialog1.FileName);
    }

```