Parent page: Service Functions – Excel (QTP, VBScript)
The question was asked here.
How can I get data from Excel spreadsheet if it is accidentally open? It ruins whole batch execution.
While opening manually I can go “read-only” and still access it.
Is there any way to read data from an open and locked Excel file from QTP?
You can programmatically open an Excel workbook and check whether it’s accessible as read-only.
If you need to get a full control of Excel data files during a batch execution of scripts I suggest the following logic.
1. Check if Excel Workbook is locked
2. Create a duplicate file
3. Use duplicated file as a data source
4. Delete when you no longer need it