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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Easily remove empty columns

Thread ID:





145805 Jul 9,2019 08:56 AM UTC Jul 12,2019 09:27 AM UTC WinForms 3
Tags: XlsIO
Paul Meems
Asked On July 9, 2019 08:56 AM UTC

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?

Abirami Varadharajan [Syncfusion]
Replied On 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. 


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

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

Abirami Varadharajan [Syncfusion]
Replied On 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. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon