Remove or update Sheets on an excel file

Hi All,

I have this situation that I need to add, remove or update sheets or tabs on an excel file. Currently, I am using the Excel sheet appender node to append multi output files, but it only adds and updates the sheet but not remove it when it is not included on the execution. My concern is how will I remove a sheet or sheets in an excel file?

Thanks in advace guys :wink:

Gambit

I think there is no ‘native’ solution for this. You might use R’s openxlsx to achieve that. Also there are Python libraries that would do the same.

edit: I notices that the R package somtimes removes more information from the Excel file than it should. So please handle with care. I will post an update if I could fix that.

kn_example_r_excel_remove_sheet.knwf (24.7 KB)

2 Likes

Hi @mlauber71,

Thank you for your help. Really appreciate it :blush:

Regards,
Gambit

2 Likes

You might have to be a little bit careful since I found some strange behaviour of the R package, though I am not sure if this might be related to the way KNIME exports Excel files. As an alternative there is a solution in Python.

https://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_python_excel_remove_sheet

1 Like

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