KNIME Openpyxl - unable to read workbook


I’m encountering an issue with KNIME openpyxl module. I’m attempting to load an excel workbook that is saved in the same folder as my project (and not corrupted).

wb = load_workbook('file manipulation.xlsx', read_only=False)

However, I receive the below error message whenever I try it. This is strange because there’s nothing unusual about the workbook and the code works fine when in a standard Python environment. Is there any reason why this would cause be causing problems in KNIME?

:x: ValueError: Unable to read workbook: could not read worksheets from file manipulation.xlsx.
This is most probably because the workbook source files contain some invalid XML.
Please see the exception for more details.
Traceback (most recent call last):
File “”, line 3847, in
File “”, line 27, in run_code
File “”, line 3843, in return_excel_template
File “”, line 92, in open_openpyxl_file
File “C:\Users\Public\KNIME\bundling\envs\org_knime_pythonscripting\Lib\site-packages\openpyxl\reader\”, line 346, in load_workbook
File “C:\Users\Public\KNIME\bundling\envs\org_knime_pythonscripting\Lib\site-packages\openpyxl\reader\”, line 307, in read
raise ValueError(

Any help would be much appreciated, thanks !

Just to add a bit of info - I tried this with an empty workbook with no formatting and it gave the same error so must be something other than the contents of the file.

@TPattison have you tried to give a full path. I think the Python folder might not be the same das your project.

1 Like

Hi @mlauber71,
Unfortunately this didn’t work, it still gave the same error message. When I put a random file name that doesn’t exist it gives a different error message so it must be able to see the file.

Hi, just to update - I’ve been testing things out and it looks like openpyxl within KNIME isn’t liking my file. My code is converting a binary file to excel, saving it then reimporting using the extract of code provided above.
The odd thing is I don’t get the error outside of a KNIME Python environment, are there any XML/ formatting restrictions within KNIME’s openpyxl library that could be causing this?

@TPattison I do not think knime is using any other library. Maybe you can provide a sample file and workflow that demonstrates the problem. Without spelling any secrets obviously.

Have you tried running any of the examples I provided?

1 Like

Turns out there was an issue with the file after all. Thanks for helping!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.