# Adressing the last Column..

**URL:** <https://forum.knime.com/t/adressing-the-last-column/21537>\
**Category:** KNIME Analytics Platform\
**Created:** [March 4, 2020, 12:27pm UTC](https://forum.knime.com/t/adressing-the-last-column/21537 "2020-03-04T12:27:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkaiser](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/ad7895/32.png) [@bkaiser](https://forum.knime.com/u/bkaiser)\
**Post date:** [March 4, 2020, 12:27pm UTC](https://forum.knime.com/t/adressing-the-last-column/21537/1 "2020-03-04T12:27:38Z")

</div>

Hey guys,

I just started with knime and want to search through 500 Excel files which have more or less the same form. I want to go into every excel and copy specific cells into another excel. My solution works okay but I got one big issue I cant resolve.  
I have a column which consists of “io” and “nio” values. But due to the excel sheet macro which created the sheet somehow managed to put the io/nio values into Column 15, 16 or 17  
But since a macro edited the sheets I have one fixed information:  
The io/nio values are always in the last column available in the sheet.

(I cant really do something about it and need to figure it out. The whole task would be searching throug about 5000 excel files).  
I tried using a Rule based Row Filter. The moment the Node wants to adress Col17, but the correspondig sheet has no Col17 (e.g. the io/nio stuff is in col15 and thats the last column in the sheet there literally isnt a col17) the program stops and exits.

Is there a way I could adress a filter and tell it: Always use the last column available and take all rows that have io/nio in it?

Thanks & regards  
Bastian

---

<div class="post-metadata">

**Author:** ![izaychik63](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/i/e9a140/32.png) [@izaychik63](https://forum.knime.com/u/izaychik63)\
**Post date:** [March 4, 2020, 12:44pm UTC](https://forum.knime.com/t/adressing-the-last-column/21537/2 "2020-03-04T12:44:42Z")

</div>

Look if this node can help you.

> **[Extract Table Dimension — NodePit](https://nodepit.com/node/org.knime.base.node.util.extracttabledimension.ExtractTableDimensionNodeFactory)**
>
> Extracts the number of rows and columns of the input table
> and outputs them as data table and flow variables.

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [March 4, 2020, 12:55pm UTC](https://forum.knime.com/t/adressing-the-last-column/21537/3 "2020-03-04T12:55:51Z")

</div>

Hi there @bkaiser,

welcome to KNIME Community!

as @izaychik63 suggested you can extract table dimension (which gives you number of columns) and then build logic to do what you need with last column values. Also you can try [Column Expressions](https://kni.me/n/2_0ji_xeG-SudFu-) node where you can automatically access last column with this following syntax:

`column(numberOfColumns()-1)`

Column Expressions is based on JavaScript syntax so you can wrap above expression into if/else clause for example to output 0 or 1 in new column that will always have same name or even better. You can just rename last column to always have same name and then use it in a Rule-based Row Filter node 😉

Br,  
Ivan

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![bkaiser](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/ad7895/32.png) [@bkaiser](https://forum.knime.com/u/bkaiser)\
**Post date:** [March 5, 2020, 6:47am UTC](https://forum.knime.com/t/adressing-the-last-column/21537/4 "2020-03-05T06:47:24Z")

</div>

I dont see the Column Expressios in den Node Repository…sorry for this “noob” question - I am quite new to Knime 🙂

---

<div class="post-metadata">

**Author:** ![morpheus](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/ce73a5/32.png) [@morpheus](https://forum.knime.com/u/morpheus)\
**Post date:** [March 5, 2020, 7:10am UTC](https://forum.knime.com/t/adressing-the-last-column/21537/5 "2020-03-05T07:10:29Z")

</div>

Hi @bkaiser,

did you installed the knime extensions? If not please install it.

If you have installed it, you can use the search field of the Node Repository to find the Node.

![Demo](https://forum-cdn.knime.com/uploads/default/original/2X/4/4a56615e8b93ed36069ca27c239b624299e7fd55.png)

BR Hermann

---

<div class="post-metadata">

**Author:** ![bkaiser](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/ad7895/32.png) [@bkaiser](https://forum.knime.com/u/bkaiser)\
**Post date:** [March 5, 2020, 9:19am UTC](https://forum.knime.com/t/adressing-the-last-column/21537/6 "2020-03-05T09:19:37Z")

</div>

My firm just has Knime 3.6 so I cant just drag and drop it in Knime - or is there another way on installing it?

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [March 5, 2020, 1:25pm UTC](https://forum.knime.com/t/adressing-the-last-column/21537/7 "2020-03-05T13:25:20Z")

</div>

Hi @bkaiser,

3.6? Wow! When is update planned? Newer version bring cool features and nice improvements 😉 Also you are lucky as Column Expressions is available from version 3.6 😃

[https://www.knime.com/whats-new-in-knime-36#column-expressions](https://www.knime.com/whats-new-in-knime-36#column-expressions)

So one way to install additional extensions/nodes is following. From within KNIME go:

`File--> Install KNIME Extensions...`

Then for Column Expressions under _KNIME Labs Extensions_ find _KNIME Expressions_ extension:

![ColExpress](https://forum-cdn.knime.com/uploads/default/original/2X/c/c9adce70e032b6cef9ae73fc430aa48aa6dd4885.png)

Hope this helps!

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [September 4, 2020, 1:25am UTC](https://forum.knime.com/t/adressing-the-last-column/21537/8 "2020-09-04T01:25:25Z")

</div>

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