C1XLBook.Load alternate column determination

Posted by: aruud on 12 January 2021, 7:21 am EST

  • Posted 12 January 2021, 7:21 am EST

    Hello Support,

    I'm using C1XLBook to load CSV files for processing. The Load function works as intended, bringing the files in and placing them into a book/sheets without error.

    However, the files I have are unusual in that they often have a header that has fewer columns than the number of columns in the rest of the file. As such, it makes it very difficult to use the XLBook since the number of columns in an XLSheet is read-only, require me to use workarounds or reload the CSV file after altering the FileStream.

    Here is a rough example:
    InfoColumn1, InfoColumn2, InfoColumn3, InfoColumn4

    In this case, the XLSheet column count will be set to 1 since there's only a single header in the first row. It would be much easier for me if it were set to 4, or I could set it to 4 manually

    Is there any possibility to add an option to the Load function that sets the XLSheet columns to the widest number of columns in the CSV file? Failing that, could we set a number of columns to look for in CSV files and insert blanks where it fails to grab? I ask this not knowing the internal workings of the Load function, so I'm aware this may not be possible.

    I'm currently developing a workaround, but it's gonna be silly, heh.
  • Replied 12 January 2021, 8:12 pm EST


    We don't see this issue at our end. If we load a CSV containing the data provided by you in the rough example then we get an XLSheet with Column count 4. Please refer to the sample attached. If you still face this issue then please provide us with a sample replicating this issue so that we can investigate this further.

    Prabhat Sharma.
  • Replied 13 January 2021, 5:16 am EST

    Hello Prabhat,

    That example works just as you described! I'm genuinely surprised since I've gotten consistent results to the contrary from my files.

    Please find attached your example modified to use the file I'm trying to load. I had to change the C1Excel reference to the local one on my machine, so it's in version 4.0.20201.416. (I'm hesitant to upgrade, it usually messes something up in the license files/references.) I also added the specific method I'm using to load the C1XLBook.

    Both methods display a behavior similar to what I described, no idea why it comes up with 2 columns instead of 1 or 10. The main difference is that my Sanitized file contains more special characters, but there may also be something that Notepad isn't showing.


  • Replied 13 January 2021, 4:35 pm EST


    We could replicate this issue at our end and it seems to be occurring when the first line has a single entry and that entry contains a colon ":". We have escalated this issue to the developers and will let you know as soon as there is an update.
    [Internal Tracking ID: 24187]

    Prabhat Sharma.
  • Replied 14 January 2021, 2:29 am EST

    Ah, glad to know I'm not insane! It had been working for the longest time before this, I should have suspected that specific file more. Thanks for the heads-up, hopefully it's not too hard to fix.
  • Replied 17 January 2021, 6:33 pm EST

    We would also like to thank you for bringing this to our attention, our development team is working on it and we will let you know as soon as there is an update.
    Prabhat Sharma.
  • Replied 27 April 2021, 9:18 pm EST


    We are happy to inform you that the issue has been resolved in the latest build, please upgrade to the latest version to get rid of this issue.
    You can update your controls using the latest ComponentOneControlPanel utility that you can download from the given link:


    Prabhat Sharma.
Need extra support?

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

Learn More

Forum Channels