Maximum number of columns exceeded (256)

Originally Posted 21 October 2016, 2:37 pm EST

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

    Hello,

    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()
    book.Load(fileName)
    ' 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
    C1XLBook1.Sheets(0).Rows.Add(row.Clone())

    Next


  • Marked as Answer

    Reply

    Hey Daniel,

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

    book.Load(fileName, FileFormat.OpenXml)


    http://helpcentral.componentone.com/nethelp/c1excel/C1.C1Excel.4~C1.C1Excel.C1XLBook~Load.html

    This would do it.

    ~nilay


    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