Python Source node error: Execute failed: object of type ‘NoneType’ has no len()

I am trying to create a Python Source node so that I can clear data from an Excel sheet’s range.
The code:
from pandas import DataFrame
import openpyxl as xl


filename1 =r"C:\Personal\Book1.xlsx"
wb2 = xl.load_workbook(filename1)
ws2 =
for row in ws2[‘A1:C3’]:

for cell in row:
cell.value = None

output_table =

if I press „execute script” button inside the node the code runs properly without error message => It runs on Jupyter notebook as well.
But when I try to run on Knime (right click \ Execute) I encounter an error message on Console “Execute failed: object of type ‘NoneType’ has no len()” The node status becomes Error but executes the code well (Clearing data in Excel on the appropriate range )

I suspect the last line but cannot figure out the solution.

Any idea?


The last lines could be something like this:

import pandas as pd
output_table = pd.DataFrame(wb2.values)

The save command cannot be interpreted as a data frame. If you do not need the data frame back you could opt for something like this where you just give back the name of the file (eg.):
output_table = pd.DataFrame( 
                { "my_excel_file" : [filename1] 

Thank you, it works now!


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