We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Easily remove empty columns

I have several Excel sheets which when opened show a warning about too many columns.
When I use 
                worksheet.UsedRangeIncludesFormatting = false;
                var lastColumn = worksheet.UsedRange.LastColumn;
I can see that for some worksheets the LastColumn is set to 1026, but they contain only between 45-50 columns.

Does XlsIO have an easy option to reset/remove the empty columns?
Or should I loop through all columns and remove the empty once one by one?

3 Replies

AV Abirami Varadharajan Syncfusion Team July 10, 2019 01:36 PM UTC

Hi Paul, 

Greetings from Syncfusion. 

We have prepared a sample to remove the empty columns from the worksheet and the sample can be downloaded from the following link. 

Kindly check and let us know if this is helpful. 


PM Paul Meems July 11, 2019 02:44 PM UTC

Thanks for the sample. It works great.
This issue can be closed.

AV Abirami Varadharajan Syncfusion Team July 12, 2019 09:27 AM UTC

Hi Paul, 

Thank you for updating us. 

We are glad that your requirement is fulfilled with the shared sample. Please let us know if you need further assistance. 

Live Chat Icon For mobile
Up arrow icon