Write to Excel Template - multiple sheets

I am using the Write to Excel Template node to insert data from KNIME into an excel template. This works fine for one sheet, but is there a way to write to multiple sheets inside an excel template? I want to do something similar to the Excel Writer node where you can write to multiple sheets, but within an existing excel template. Is there a node that does this?

I’m currently doing a number of Write to Excel Template nodes to accomplish this, but it’s a bit messy and I don’t know how to control the order in which they run. But my current work around is like this:

Read from Template.xlsx
Output - create new file - Template1.xlsx

Then for the next sheet:
Read from Template1.xlsx
Output - create new file - Template2.xlsx

Read from Template2.xlsx
Output - create new file - Template3.xlsx

And continuing until I’ve added all the sheets I need to the Excel Template. Is there a node which can write multiple sheets to an excel template? Is there a better way to do this than multiple Write to Excel Template nodes, and is there a way to control in which order the nodes execute?

On the write order with your existing setup you can connect the write nodes with flow variable connectors which should control the order of execution. I’m a little unclear on the larger issue. If all the sheets you want to write were in one Excel workbook, you could extract the sheet names and feed them to the writer one at a time inside a loop. It appears that you’re doing some kind of cascading in which case that won’t work. Could you clarify? A screenshot of your current workflow would probably help.

1 Like

@rlesse you can overwrite the whole excel file on the first loop and then add the sheets as you go to have the correct order.

If you absolutely must you can change the order of sheets later with the integrated Python extension and OpenPyxl:

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