This project has moved and is read-only. For the latest updates, please go here.

Deleting work sheet if it already exists in the workbook

Jan 5, 2011 at 10:23 PM
Edited Jan 5, 2011 at 10:24 PM

How do I delete an existing worksheet if it already exists in the workbook?

 

I have found that workbook.Delete(int index) ....

 

What if I don't know at what place my sheet is there in the workbook (in my case...)? :)

 

 

 

Thanks

Srikanth Kambhampati

Jan 9, 2011 at 6:46 PM

Hi,

Something like this ...

Workbook.Worksheets.Delete(worksheet.PositionID)

 Jan

Jan 10, 2011 at 11:05 PM

It says "'OfficeOpenXml.ExcelWorksheet.PositionID' is inaccessible due to its protection level"

 

 

Is there any way to fix this??

 

Jan 11, 2011 at 7:01 AM

hmm, I see what you mean. I should have verified that a little bit better :(

I'll add a fix for it next time I check in.

 

May 19, 2011 at 10:17 PM
Edited May 19, 2011 at 10:25 PM

Can you do a quick check-in for this paper-cut?

Your visual studio is newer than mine so I am having trouble opening your .sln file and compiling my own version.


Greatly appreciated.

 

EDIT: Sorry about the post, I've figured out how to compile with "msbuild.exe". Thanks for this great library!