Get workbook Delete Sheet

Can any one suggest how to delete sheet from get workbook sheet once i get all sheet name for List(Sheet) how to delete particular sheet

1 Like

Hi

we can use the Delete Sheet activity.

To get that activity, please install this package: BalaReva.Excel.Activities
image

we can pass the sheet name as input here to this select range activity and then delete with send hot key as per this page

Cheers @Arun_Pondhe

1 Like

Hi @Arun_Pondhe

Go to Manage package BalaReva.Excel.Activities

Regards,
Kommi Jeevan.

1 Like

Delete Sheet activity not work every time :slightly_smiling_face:

Delete Sheet activity not work every time :slightly_smiling_face:

1 Like

hmm…may i know the issue we were facing
or
we can try with hot keys did that work

Cheers @Arun_Pondhe

Hot key is not working as per ALT h d s

You can try to invoke VBA where the VBA code will get as parameter the name of the sheet you want to delete.
Something like this: deleteSheet.zip (9.8 KB)

invoke VBA also not work every time i tried it also

i try this one

Dim excel_raw As Microsoft.Office.Interop.Excel.Application
Dim wb_c As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
Dim ws_c As Microsoft.Office.Interop.Excel.Worksheet
excel_raw = New Microsoft.Office.Interop.Excel.ApplicationClass
excel_raw.DisplayAlerts=False
excel_raw.Visible=False
wb_c = excel_raw.Workbooks.Open(“C:\Users\Arun Pondhe\Documents\UiPath\Latest_final_Add_Fixed\VendorManagementProject\ExcelMatch\Fixed_Cash_Upload_File_Output\Final_Fixed_Cash_Zsalary_upload_File.xlsx”)
ws=CType(wb_c.Sheets(“330_GreaterLine”),microsoft.Office.Interop.Excel.Worksheet)
ws.Activate
ws.Delete
wb_c.Save
wb_c.Close

excel_raw.Quit

When it works and when doesn’t?
Or can you give an example of the sheet name that can be deleted and sheets that you can’t delete?

actually i tried to simulate with balareva activities for excel
it was working fine
may i know what was the issue you were facing
we can directly mention the filepath and sheetname
here as we are iterating through sheetnames from getsheet in a FOR EACH LOOP mention the input to SHEETNAME property as item.ToString
where item is the variable name from for each loop

Cheers @Arun_Pondhe