We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

IO Exception when opening/importing from Excel file that's already open

Hi.

I'm using Aspose.Cells in Windows Forms and I notice that if I try to open an Excel file that's already open in Excel, I get an IO exception. Is there a way to Open the file regardless of if it's open already?

I am opening the file only to read/import data from it, so this should be possible, but I can't seem to find the method or option to do so.

Thanks!

Hi,

Well, we use File.OpenRead to open a file when you call Workbook.Open(string filename)
File.OpenRead will throw an exception if the file is opened by using MS Excel which is correct logically.

e.g

FileStream fs = File.OpenRead(@“F:\FileTemp\book1.xls”);
But if the book1.xls is opened in MS Excel exclusively, it will throw an exception.

If you can export the file to stream, then we can get the data from that stream.


Thank you.