I have followed the examples and am successfully reading an excel file into a workbook. However, it errors out if the file is currently open in excel. This "feature" is not going to go over well with my end users. I cannot find any settings that act appropriately.
Workbook wb; Worksheet ss;
wb = Workbook.Load(excelFileName);
Receive the following error:
"Error while processing work sheet: The process cannot access the file 'c:\pathname\combined.xlsx' because it is being used by another process."
You can manually open the file using the FileStream constructor that takes a FileShare value of ReadWrite. This allows you to share the file with other programs reading and writing it, which MS Excel states it wants to do when it has the file open:
Workbook wb; using (var stream = new FileStream(excelFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) wb = Workbook.Load(stream);
Workbook wb;
using (var stream = new FileStream(excelFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
wb = Workbook.Load(stream);