Hi,
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
ClearDataRangeInExcel
filename1 =r"C:\Personal\Book1.xlsx"
wb2 = xl.load_workbook(filename1)
ws2 = wb2.active
for row in ws2[‘A1:C3’]:
for cell in row:
cell.value = None
output_table = wb2.save(str(filename1))
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?
Thanks,
Gabor