How to delete a sheet from workbook without using excel scope activity?

I don’t have excel software installed in the machine. So I need to delete a worksheet without excel dependency.

Him
Give a try with this component

Cheers @Karthik_NS

1 Like

Hi @Palaniyappan

That package will work out only if we have excel installed in the machine. I have confirmed it with the creator yesterday.

Could you assist me in any other way?

Thanks,
Karthik N S

Fine then

I haven’t tried with this script
But give a try on this
Meantime I will check for an option

Cheers @Karthik_NS

@Karthik_NS, you can use simple C# script to remove the sheet:

Workbook workbook = new Workbook();
workbook.LoadFromFile(WorkbookPath);
workbook.Worksheets.Remove(SheetName);
workbook.SaveToFile(NewFileName);

Or you can go with VBA:

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

Hi @ManiPrajwal_K,

When I use the C# code I am getting the error as “Are you missing any workbook assembly reference”?

What is the assembly reference for this and how can I add it?

Hi @Palaniyappan

The “Microsoft.Office.Interop.Excel.Application” assembly reference need the excel application to be installed in the machine. So I think i cannot use this.

Beside arguments tab you can find references tab, click on it then search and select for Microsoft.Office.Interop.Excel

That’s still going to need Excel installed.

There most likely isn’t a way to do this without Excel installed.

One possibility, I suppose, is to install a free Office clone (like Open Office) and use that to open the file, and use regular click etc activities to navigate around in it and delete the sheet.

For this Microsoft.Office.Interop.Excel,

We need to have the excel installed in the machine. I don’t have the excel installed in the target machine.

you need an excel to perform delete sheet operation on the file. VBA and Excel activities require excel application

You can consider reading the sheets you need and creating a new file out of those sheets only

Thank you @Palaniyappan (Thambi).

But the BalaReva Excel must have the excel installation.

Regards
Balamurugan.S