Hi
I am populating the excel with data from various datatables. My spreadsheet will have around 18 worksheets.
The default WorkSheet1 is the last worksheet. My client don't want to see the default worksheet.
I could not find a way to delete the default WorkSheet1. Below is the code which throws an error - Key not found.
Worksheet workSheet1 = workbook.Worksheets["WorkSheet1"];
workbook.Worksheets.Remove(workSheet1);
Please help.
Hi,
Actually the error seems pretty descriptive and I guess it throws the error on the first line because it fails to find this worksheet. Please make sure about the key, however you can try to get the worksheet by its index.
Please let me know if you have any questions.