How to create sheet in excel

I need to create sheet in excel and delete it if it is not possible by uipath how to use in vb script

Hello @sruthesanju ,

To create a new sheet:
You just need to use a Write Range activity with the name of your new sheet and the data table you want to write.

To delete a sheet, you can use this VBA script:

Sub vba_delete_sheet()
Sheets(“SheetName”).Delete
End Sub

Where you can replace SheetName by your own sheet name.
To use VBA in UiPath, you can use invoke VBA activity.

Best,
Charbel

Hi @sruthesanju

Use invoke VBA pass the text file,

Pass the procedure name for creating and deleting the sheet according to your need.

In text file create two procedures as below,

Sub create_sheet
  Sheets.Add.Name = "NewSheet"
End sub
Sub delete_sheet
  Sheets("yoursheetname").delete
End sub

For references for how to invoke vba in UiPath,

Thanks

Hi @sruthesanju

It is possible to do in Studio X. Refer to the screenshot

Regards
Gokul

Hi @sruthesanju ,

Here is an activity called “Add Sheet” to add a new sheet in excel. here is the package.

Regards
Balamurugan.S

1 Like

I am able to create sheet but unable to delete it.i am getting late binding error

Can you please send screenshots of your workflow as well as a screenshot of the error?