Maximum number of columns exceeded (256)

Originally Posted 21 October 2016, 2:37 pm EST

  • Originally Posted 21 October 2016, 2:37 pm EST


    I would like to merge rows of .xlsx-files into one. The way I do it gives me an Exception:

    "Maximum number of columns exceeded (256)"
    Some Excel-files I load from the filesystem have more than 256 columns. Is there a way I can get around that exception?

    ' load Excel file
    Dim book As New C1.C1Excel.C1XLBook()
    ' clone and rename first sheet (sheet names must be unique)
    Dim clone As C1.C1Excel.XLSheet = book.Sheets(0).Clone()
    clone.Name = System.IO.Path.GetFileNameWithoutExtension(fileName)

    For Each row As C1.C1Excel.XLRow In clone.Rows

    ' Exception thrown here

  • Marked as Answer


    Hey Daniel,

    You can explicitly notify to load OpenXml type excels using this:

    book.Load(fileName, FileFormat.OpenXml)

    This would do it.


    PS: 2003 excel files (Biff8) imposed restriction of 256 columns.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels