When trying to Open Excel files (.xlsx or .xlsm), while the file still opens, I get the error:
I think it does it with the Open and Close Application commands.
AttributeError: ‘<win32com.gen_py.Microsoft Excel 16.0 Object Library._Workbook instance at 0x2573790585032>’ object has no attribute ‘len’
I think this happens mainly with RPA.Excel.Application and not RPA.Excel.Files
I’m trying to open the Excel file to increment a cell value by so it can be processed as a unique file.
I have tried to open a file, run a macro in it and save as .xlsx (opens as a .xlsm)
Or open the file and copy a variable from robot framework into the cell.
I’m using Robocorp on Windows 11 with the latest MS Office. (Version 18.2106.1240.0)
Hi there Mike,
It happens for me to have an arm64 Windows 11 to test this with. Can you attach for me a dummy example for that Excel file you’re trying to open? (as I want to replicate your issue first)
Also, what rpaframework version are you using with your robot?
Thanks for the reply.
Firstly I was eventually able to solve my issue using RPA.Excel.Files and use Robot Framework variables to generate a unique ID and input that variable into a cell without issue.
As for the library RPA.Excel.Application, it seems to give that error even with a brand new blank xlsx file and just trying to open the file.
I only installed Robocorp Lab last week and also did the update that just came out.
I’m not sure where you have RPA.Framework version number listed, but I assume it’s the latest.
I’m on windows 11 with an 11th Gen Intel(R) Core™ i5-1135G7 @ 2.40GHz 2.42 GHz so that’s an x64 based processor.
The packages are listed in the conda.yaml file, including the rpaframework. There you can see the version number it has.
The latest rpaframework version at the moment is 11.5.2 so you could update to it. I guess that template you were using is not up-to-date with the latest.
Investigated it a little bit and might be an issue on how the
.workbook.Worksheets() handles the workbook active sheet setting internally. Might help the testing if you can provide to us the Excel version you’re using and from what Office package comes from (like 365 family/business/etc).
@mika Thanks. Conda.yaml states I am on RPAFramework 11.1.3
@cosmin Office version 18.2106.12410.0 as stated earlier. It is MS 365 Apps for Enterprise.
It says it is Excel version: 2110 (Build 14527.20234)
Wondering if that is why the error references Excel 16.0?
Trying to go through your documentation, do I just update the package value to 11.5.2 and rebuild the environment? I did that and same error persisted.
Yes Mike, you did it well. I was able to confirm the issue with Office 2021 on Windows 11 and we discovered it was a problem with a Windows related library dependency version. Until we fix it properly, there’s a quick workaround you can do on your side to get unblocked:
Add in your conda.yaml file the
pywin32==302 dep right under
- pip: as seen in this example. And here’s the example robot I used for testing and works as expected now.
Awesomesauce. I look forward to using the RPA.Excel.Application Library as I continue to build out some more test coverage. Thank you!
And this is the actual fix currently WIP.
This just got officially fixed now as of