How to automation get dynamic range in Excel

in here, i have sheet want get range, the table always begin form line 32 of collum A to N and dynamic below, so, how to get range of grid have value below by theway dynamic ?
example: i want get range A32:N42 but use dynamic

CI PL220600426.xlsx (105.5 KB)

here is file excel

Hey @Hi_p_H_a_Hoang,

Read the whole sheet without header and remove all the rows before the header of actual datatable. And create a datatable and load all the rows from input datatable to output datatable.



Is the data above is in table table format?
If it you can use to get table range activity or use modern activities, it will auto detect the table name if you read entire sheet


i should use what activites in uipath to detect that table, because it is excel file

In classic use "Get Table Range and mention excel sheet name and table name maintain constant table name if possible pass the table name.

in modern u can find custom input in read range activity there can mention table name


1 Like

Can you make demo for me. i dont know what activites use to do that ?

i know Read Range but it not support get range dynamic for me

Hey @Hi_p_H_a_Hoang,

As @RK_0 suggested you can use modern activities it will autodetect the table.
PFA the screenshot for refrence


1 Like

what is datatype of variable “_FilterDatabase” in range ?

Can you send me .xaml file ?


Type of variable is System.Data.DataTable


i think its string type because it use double quotation marks, so i dont know he was assign for it what things ?

i try it active in one excel file, but i have multi excel file so i dont know how to create a variable to make Read Range become dynamic

Assuming that you know where the table start (A30 i think based on your example) it is so simple:

Use Activity UiPath.Excel.Activities.ReadRange
Input Argument RANGE put Start Cell Position (like “A30”)
In addition you can check AddHearders (if you want to extract the first Row as Headers)

And that is all :slight_smile:

thank for answer,
but i just want get data in one range, i dont want get data below first blank row begin row A30, exam A30 to N*(exam N42 ,…) not get data from line 43 to below.


are you talking about

Excel.Shhet("CI CUSTOMS").Range("_FilterDatabase")

.Range(“_FilterDatabase”) right?

Yes, it is the string type.


I have idea quite stupid but it work with me.
Assuming i want get range from A30 to N40(This is dynamic variable)
i get value from cell A32 and count for each row until matches first blank row then +2 to count. example: A32 to 40 is 8 then +2 is 10. i assign to LastRow=30+10
i will create a variable Temp=“A30:N”+LastRow.ToString . and it done!

1 Like

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