Forum Discussion

jaydesai's avatar
jaydesai
Occasional Contributor
2 months ago

Test complete tool does have rights to open excel file

Trying to run the python code below and log message shows access denied

def ExcelExample():

 excelFile = Excel.Open("C:\\temp\\DataStorageExcel.xlsx")

Notes

1.excel does have password and manually, it can open 

Thank you 

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Is the spreadsheet already opened in Excel? I suggest you check your Task Manager to ensure no other Excel processes are opened.

  • jaydesai's avatar
    jaydesai
    Occasional Contributor

    Thank you for the update! 

    did check and no other Excel file is opened

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Frequent Contributor

    Hello,

    I am not sure I understand your message. The error says "removing file" while your statement is open file. If you are attempting to delete an open file, first you need to close it.

    I don't believe TestComplete can open a password protected file, I get a different error. Probably you need third party libraries to decrypt.

     

  • jaydesai's avatar
    jaydesai
    Occasional Contributor

    Hi,

    Thank you for the update

    I have recorded steps. Please see

    • rraghvani's avatar
      rraghvani
      Champion Level 3

      There's no recorded steps or anything attached!

    • rraghvani's avatar
      rraghvani
      Champion Level 3

      You are opening a different file here, which is not C:\\temp\\DataStorageExcel.xlsx?

       

      The example that I've tried, works fine

      I suggest you use double back-slash as opposed to raw string in path name.

      When you double click the error message, what line does it take you to? Because the error message is relating to removing a file, and not opening a file!

      When file is already open or read protected, Save will error

      Can you provide that exact code that is actually failing? You can use "Insert/Edit Code Sample" icon

  • jaydesai's avatar
    jaydesai
    Occasional Contributor

    Sorry for the confusion. According to previous screenshot, the location path is correct

    • rraghvani's avatar
      rraghvani
      Champion Level 3

      Create a new project, with your code, to eliminate any other issues.

      Provide that exact code that is actually failing, you can use "Insert/Edit Code Sample" icon