Remove or update Sheets on an excel file

#1

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

0 Likes

#2

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)

1 Like

#3

Hi @mlauber71,

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

Regards,
Gambit

2 Likes

#4

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.

1 Like