Specific value in a specific cell - Write to Excel

Hi friends,

It’s possible to show a specific result into a specific cell on a table.
Similar like this:

I have a group by node
image

This is the result:
image

Then I will use another “Group by node” to sum this column
image

This is the result:
image

Then I want to show the result above in Excel Writer, inside de first “Group By” node, like this:

Simulation:
image

It’s possible?

Let’s say that if I had did that in VBA, I know it’s possible.
What about Knime?

@Felipereis50 there is this node to change cells in an Excel sheet

Another option would be to use OpenPyxl

4 Likes

And for a 3rd option you can use this if you want to keep the excel file’s formatting in place. As long as you don’t select the option to “Remove all Data Before Writing” in the Advanced tab, any missing values coming over from KNIME will leave the existing excel data in place. You can also select a starting row or column for your write, so you can narrow in on a specific cell that way if you filter down to 1 column and row before you write.

2 Likes

Hi friend.
Thanks

I’ll study the flow you went through.
But since I don’t know much Python, maybe I can’t understand everything.

in KNIME you could also just use a joiner on the Row ID for your original table and your grouped table to get it next to the value in row 0
br

Hi @Felipereis50 ,

Here is a further option if you are using KNIME 4.7

I have a component on the hub:

It can write either a literal or an Excel formula directly into a cell reference on an existing spreadsheet. The cell reference and any formula can be entered in the form of a literal, e.g. E2 or it can interpret values of flow variables, to make it easier where you want to write to a location that changes because of dynamic data sizes

e.g.

or you could just write the value of a flow variable instead of a formula:

Flow variable references take the same format as you’d find in the String Manipulation node, and if they are in square brackets, you can also include basic arithmetic to allow you to include simple offsets e.g.
E[$$(INumber Rows)$$+3]

Would take the value in the Number Rows integer flow variable and add 3 to it , so if it contained the value 7, this would refer to cell E10.

A simple demonstration based on your post is here:

A more complex demonstration is here:

1 Like

Hi Friend.

That’s exactly what I want.
Amazing job that you did.

Congrats friend.

#loveknimeCommunity :grin:

2 Likes

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