In Excel Read Range need to read the sheet from A2:E(Last row)

Hi,
I have an Excel Sheet containing Data in Columns A till F
Where A1:F1 contains Headers and I need to read the excel from A2 till the last row of containing Data in E Column.
How to do it using read range?
Here I have provided excel sheet
Employees.xlsx (12.5 KB)

@Kunal_Jain

You can just provide the start cell and excel eill automaticaly read till end…

If you want to read with header then give A1 and select headers option

If without headers then give A2 and uncheck headers option

Then if you dont want column F can use remove data column activity and provide the column index as dt.Columns.count-1

Cheers

HI @Kunal_Jain

Try this

  • Excel Application Scope
    • Read Range from “A1” and store them in a DT_ForCount
    • Read Range “Without Headers” From “A2:E”+(Dt_ForCOunt.Rows.Count+1).ToString. and store them in the datatable called DT_MasterData

Regards
Sudharsan

Read Range with A1 and select headers, or A2 and deselect headers, then remove any columns you don’t need.

No it is not giving the desired output
Can you just help where I can use Read range activity to get the datatable without last column present.

Have you tried this ? @Kunal_Jain

@Kunal_Jain

May I know what is not correct…

If you dont want to read whole…then read the data first into a datatable using range as “A1” then use another read range with range as "A1:E" + (dt.Rowcount+1).ToString …dt is the output of first read range

Cheers

Hi @Kunal_Jain ,

Check this below workflow attached and I have used the file which you provided,
Uipath_ReadSpecifiedRange.zip (13.6 KB)

Hope this will be useful for you :slight_smile:

The code is working for the sheet I provided but it is getting stuck in an xlsb sheet which I cant share here.
It is taking time and not completing the process.
It has column starting from A1 till BG and I need data from A2 till the end value of BF column.

Invoke VBA: Get Last Row: Exception from HRESULT: 0x800A9C68
I am getting this Error

Hi @Kunal_Jain ,

Have you passed the sheet name in the Invoke vba property as shown in below screenshot,

Have you enabled below property in your excel settings?

3 Likes

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