Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

load last n rows from excel

Hello. I hope someone can help me.I want to load the last n rows from a table in excel.How can i do that?

1 Solution

Accepted Solutions
fernandotoledo
Partner - Specialist
Partner - Specialist

You have to load all table first then, use the NoOfRows('table') Function to know how many rows there is in the table and store it in a variable, like

LET a = NoOfRows('tab1');

then load it again with a "where RowNo() > $(A-N)" statement

View solution in original post

18 Replies
fernandotoledo
Partner - Specialist
Partner - Specialist

You have to load all table first then, use the NoOfRows('table') Function to know how many rows there is in the table and store it in a variable, like

LET a = NoOfRows('tab1');

then load it again with a "where RowNo() > $(A-N)" statement

Not applicable
Author

Thanks for the reply.It seems that there in no way to avoid the first load.

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi konstantinos,

do you know how many rows you want to load? You can use the header size with a variable and then load the titleline with the fieldnames to rename all fileds.

Not applicable
Author

Hi Martina,

thanks for the reply.Unfortunately i don't know the number of rows.

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, konstatntinos,

how do you find them out? Did you try the possibilities of Enable Transformation Step? there you can enter conditions to find the right lines to load?!

Not applicable
Author

Hi Martina,

the only condition is that the rows must be the last n in the table. I tried the Transformation step but since the number of rows is not fixed i did n't find something that will do the job on any case.

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, konstantinos,

do you know any condition how many n rows you have to load?

Miguel_Angel_Baeyens

Hello Konstantinos,

Maybe not the most beautiful way, but loading the table frist to know the number of rows (I don't know any other way of counting them, but loading it or even -untested- connect via ODBC/OLE DB) then you can use function RecNo() to start loading when RecNo() greater than total rows - n.

Does that suit you?

Not applicable
Author

Hi Martina,

n is a fixed number, e.g n=5. I just need the last 5 records added to a table.