Open the specific sheet from the excel

Hi, If you see I have multiple sheets in the excel, But I while reading and opening, I want to see only the particular test sheet in excel. Here what happened I am reading the test sheet but when I open the excel it show me the Sheet1 only. But I want to open only the test sheet on screen and perform some operation. But automatically it open Sheet1 only. How can I open always specific sheet from the excel?
image

@Palaniyappan @HareeshMR

1 Like

Hey @balkishan

In Read Range You Have To Mention Sheet Name “test”

Thanks

Hi @balkishan,
You can use invoke code and put the below code

Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
excel = New Microsoft.Office.Interop.Excel.Application
wb = excel.Workbooks.Open(in_Path)
excel.Visible = False
ws = CType(wb.Sheets(“Sheet2”), Microsoft.Office.Interop.Excel.Worksheet)
ws.Activate()
wb.Save()
wb.Close()
excel.Quit()

in the in_path put your excel path and replace the sheet2 with whichever sheet name you want to activate.

2 Likes

Already mentioned but not opening, it’s opening automatically Sheet1 only.
image

in manage packages install the BalaReva package.

1 Like

Ok Fine @balkishan

Manually you can open the excel file.Then click on the “test” sheet.
Then save the excel file once.Then After use read range activity mention the sheet name as “test”

Thanks

Okay removed, Now where I have to put this activity. Before Excel Scope OR inside the Excel Scope.
image

you can put anywhere it will activate your given sheet name of the path you passed.:slight_smile:

1 Like

This is not a solution.

Fine
are we trying to open the excel in foreground or in background
@balkishan

1 Like

In Foreground bro.

1 Like

Provide the entire path of the file. like example
“C:\Users\xxxx\Documents\wrd\xxxx\xxx.xlsx”

2 Likes

It’s working but not as per expectation, first it open the excel and automatically open with Sheet1, Then it open the Test sheet which I gave the name, But again it show me the Sheet1 only.

put it once outside the excel scope and try.

1 Like

But, let me ask: Why do you need that sheet for?

I mean you can just read the sheet you need (“test” in this case) as they mentioned you above, and store the information in a variable/somewhere so you can work with the data in it

1 Like

And one more when the file is opening, it show me this message popup.
image

well,
I am open the Excel file, then open the Test sheet only OR you can say that only Test sheet will be visible in Excel file. I am performing the Operation with the Send Hotkey bro. Hope you understand.

I understand, but my point is depending on what you need this might not be the best option.

1 Like