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

Free Support Forum - aspose.com

Check if excel is already open

Hi Team,


I have a scenario in which which i am uploading excel files and i want to validate that excel file and throw error if it is already open.

Is it possible to check using aspose.cells that uploaded excel file is already open?

Thanks in advance,
Sumit

Hi,


Thanks for your query.

Well, you may accomplish the task by simply obtaining the file into streams with proper accessibility, see the sample code for your reference:
e.g
Sample code:

try
{
//Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(“e:\test2\sample.xlsx”, FileMode.Open, FileAccess.Write);


//Instantiating a Workbook object
Workbook workbook = new Workbook(fstream);
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}

If the file is already opened by other process or you have already opened it into MS Excel manually, it would throw an exception.

Hope, this helps a bit.

Thank you.

Hi


Just Google it and you’ll find links such as the following:
http://stackoverflow.com/questions/18015193/how-to-check-if-application-is-running

Hi,


Good to know that you got your desired way to achieve your requirements. In case of any query, comments or issue regarding Aspose.Cells APIs, let us know and we will be glad to assist you soon.

Thank you.