'C# : Run Excel without File.WriteAllBytes

How to run Excel without creating a file? (File.WriteAllBytes) do you have any suggestions for protecting the excel from being copied by the user?

public void openExcel()
{

            string tempPath = Path.GetTempPath(); 
         
 
            string excelPath = Path.Combine(tempPath , fileName);
          
            File.WriteAllBytes(excelPath, Properties.Resources.excel);
            
            Excel.Application excelApplication = new Excel.Application();
            Excel._Workbook excelWorkbook;
            
            excelWorkbook = excelApplication.Workbooks.Open(excelPath, Password: "1234");

            excelApplication.Visible = true;

            
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source