Increase size limit of data import from csv into Excel

35,651

Solution 1

Firstly, Thank you all for your help in trying to solve this. It turns out excel can quite happily accommodate more than 255 chars to a cell (presumable up to 32,767 as previously mentioned if you've got the ram for it.

So why didn't is work?

The short answer is I'm not sure. The first time I brought the data into excel I exported as a csv then opened in excel. This cut the columns short (at 255). (the csv file contained all the data when viewed through notepad but not when saved again through excel).

The column in question did contain some semicolons, but this didnt correspond to the cut off point (always 255) and I wasnt using ; as a delimiter.

My solution wast to do an export as an xls file. This has since been saved successfully as a csv file with the full data.

Hope this helps someone even though I'm still not sure exactly what the issue was here.

Solution 2

There is a weird bug in Excel. I'll explain here how to avoid (not fix, just avoid) it, and maybe it will fixed soon by MS Office programmers. Maybe it even WAS fixed in Excel 2013, I did not open it yet.

So, this is the problem.

The maximum length of the text cell is 32767, and it's OK.

The maximum length of the number cell is 255, and it's OK.

But if you have a cell that calls to number parser, fails and then calls to text parser, here will be the big mess.

For example:

...,"This is a cell with 30,000 characters........",...

will work.

But if you'll put a little minus at the start, as in

...,"-This is a cell with 30,000 characters........",...

you'll see only 255 first text characters, because EXCEL thinks it's a negative number.

Hope it helps.

Solution 3

I ran into this problem with a csv file that had some long text fields that sometimes began with a dash. It seems that Excel's import tries to process the field as a number because of the dash, and the number import trims it to 255 characters. When that fails, it imports it as text, but only the first 255 characters.

To avoid the problem, I had to import the csv instead of just opening it. In the import wizard, I selected the column that was having trouble and switched its type from General to Text. Then Excel won't even try to parse it as a number, and I get the full column width.

Share:
35,651

Related videos on Youtube

SwiftD
Author by

SwiftD

Updated on September 18, 2022

Comments

  • SwiftD
    SwiftD over 1 year

    I have a load of data in a csv file that I'm importing into Excel, most of it is fine, but one of my columns contains up to 1000 characters of data. Unfortunately, Excel has taken it upon itself to assume that's more data than I need and seems to be cutting it short (at 255 chars).

    How can I increase this limit and retain all my data?

    • Admin
      Admin over 11 years
      It says 255, and when i look at the data In the formula entry box it just suddenly stops. I can display the full data in open office, but as soon as I paste to excel it seems to be limiting to 255 chars. The reason I am not using open office is because I can past as data or do a vlookup in that.
    • Admin
      Admin over 11 years
      Excel can handle texts longer than 255 chars. However, if the cell is filled by VBA, it is a bit complicated. What's your source? How do you get it into Excel?
    • Admin
      Admin over 11 years
      I have a csv export from magento. If I open in OO it has the full text. If I open in Excel its cut short. Also gets cut short when I paste from OO to excel and I cannot manually type any more in the cell, it just gets cut off at the same point as soon as I leave the cell.
    • Admin
      Admin over 11 years
      Maybe something is off with the CSV? Can you update your question and post some lines? Also, maybe the delimiter and separator settings on your machine start acting up?
    • Admin
      Admin over 11 years
      Does your CSV file have a header line? If so, post it.
    • Admin
      Admin over 9 years
      I'm favoriting this because @khitron23 is the only one that seems to know the answer of this in the whole Internet.
    • Admin
      Admin almost 9 years
      Yeah, this is a real thing. I just ran a query in Access, copied the results, and pasted into Excel. I ran a check on the MAX(LEN()) in Access, it was over 6,000 chars. I ran the MAX(LEN()) in Excel, and it stopped at 255 chars, totally truncating the data. So it's either an Excel bug, or a clipboard/copy/paste issue. I will have to 'export' from Access and open in Excel to get the full data.
  • Vicky
    Vicky over 11 years
    No, that's the COLUMN WIDTH. From the same table, the "Total number of characters that a cell can contain" is 32,767 characters.
  • Marcus Chan
    Marcus Chan over 11 years
    @Vicky, isn't that the problem the asker is experiencing? Or did I misinterpret the question?
  • SwiftD
    SwiftD over 11 years
    @nixda real? yes real annoying. I cant believe excel cannot handle more the 255 chars. There is a way to do this!
  • SwiftD
    SwiftD over 11 years
    @Marcus I dont understand what it means by column width. This isn't just a display issue the data isn't there. It gets cut short. when I save as a csv the data isn't there. when i do len(cell) the result is 255.
  • Vicky
    Vicky over 11 years
    @MarcusChan, the number of characters should be limited to 32767. The user is experiencing it being limited to 255. What you were referring to was the column width which is to do with how the column is displayed, which is not the OP's problem.
  • Marcus Chan
    Marcus Chan over 11 years
    Hmm, I was assuming it was a problem with Excel importing the csv data as a single line (which of course it does, no line breaks in csv) and not supporting that width with wrapping off (default Excel formatting, right)? and truncating the data.
  • Marcus Chan
    Marcus Chan over 11 years
    Simple Googling results in a lot of forum post of people who have the same problem; it's probably just a bug in the Excel CSV import routine.
  • astrojuanlu
    astrojuanlu over 9 years
    This is the weirdest and most stupid bug I've ever seen in commercial software. It's literally driving me insane how on Earth can you pay for this kind of sh*t.
  • Vomit IT - Chunky Mess Style
    Vomit IT - Chunky Mess Style almost 7 years
    Is this different than what someone else may have already mentioned in an answer? This may need to be flagged and you can ask a moderator to convert to a comment since you don't have enough rep to do on your own.
  • Vomit IT - Chunky Mess Style
    Vomit IT - Chunky Mess Style over 6 years
    Consider adding some reference to this answer supporting what you state.
  • BurninLeo
    BurninLeo over 6 years
    Very good explanation, thank you. Unfortunately, I can confirm, that - 3 years later - the bug is still present in Excel 2016...
  • khitron23
    khitron23 almost 6 years
    Well, @BurninLeo, I can say you that three days after my original answer, I has made a chat call to MS Office developers Center, and gave them a link to this Super User Topic.
  • Carsten Franke
    Carsten Franke over 4 years
    The problem seems to be resolved with Excel 365 ProPlus version 1902.
  • geeves
    geeves about 4 years
    Can confirm this feature/bug is still in Excel 2016 as of April 2020.