2

So as many others have asked in the past is there a way to beat the 32k limit per cell in Excel?

I have found ways to do it by splitting the work load into two different .txt files and then merging the two .txt files, however it is a giant PITA and more often then not I end up only using excel to its limits as I do not have time to validate the data after .txt file merges anymore this is a long process and tedious IMO.

However I think that if the limitation is there it is there because it was coded when Microsoft developed Excel, and since they have yet to raise it (2013 version the limit is still the same limit so it would do no good to upgrade)

I also know that many will say if you have a need for information in a single cell in that length then you should use ACCESS well I have no idea how to use ACCESS or how to import a tab delimited file into ACCESS like you would into EXCEL, and then even if I could figure that out I still now have to figure out how to learn all the new commands and he EXCEL equivalents if there is even such a thing.

So I was browsing some blog posts the other day on how to beat limitations by software and I read something about reverse engineering.

Would it be possible to load excel into a hex editor, go in and change every instance of 32767 to something greater?

6
  • Excel allows you to enter up to 32,767 characters in each cell and displays only the first 1,024 characters in each cell. Check this excel specs here: office.microsoft.com/en-in/excel-help/…. And Sorry you cannot reverse engineer to change the limitation as what you have is Excel EXE. you cannot reverse engineer EXE.
    – Paresh J
    Nov 10, 2014 at 6:01
  • 1
    @PareshJ, it may be difficult to reverse engineer an EXE, but it's not impossible. Nov 10, 2014 at 11:46
  • @RickHitchcock: Actually! Its impossible task.
    – Paresh J
    Nov 10, 2014 at 11:49
  • @PareshJ, sorry to disagree, but this is something I've done myself. (Though not at the scale of Excel's executable.) See my post. Nov 10, 2014 at 12:25
  • 1
    Even obfuscated, if Windows can determine what to do with an executable, we can determine how it works. If it's encrypted, there must be a decryption key that Windows has access to, which we should also be able to determine. It's been years since I've done something like this, but unless microprocessors have changed drastically, this should be possible (though difficult). Nov 10, 2014 at 14:19

3 Answers 3

9

While 32767 may seem like an arbitrary number, it's actually the upper limit of a 16-bit signed integer (called a short in C). The range of a short goes from -32768 to 32767.

A 16-bit integer can also be unsigned, in which case its range is 0 to 65535.

Since it's impossible for a cell to have a negative number of characters, it seems odd that Microsoft would limit a cell's length based on a signed rather than unsigned 16-bit integer. When they wrote the original program, they probably couldn't imagine anyone storing so much information in a single cell. Using shorts may have simplified the code. (My first computer had only 4K of memory, so it's still amazing to me that Excel can store 8 times that much information in a single cell.)

Microsoft may have kept the 32767 limit to maintain backward compatibility with previous versions of Excel. However, that doesn't really make sense, because the row and column counts greatly increased in recent versions of Excel, making large spreadsheets incompatible with previous versions.

Now to your question of reverse-engineering Excel. It would be a gargantuan task, but not impossible. In the early '90s, I reverse-engineered and wrote vaccines for a few small computer viruses (several hundred bytes). In the '80s, I reverse-engineered an 8KB computer chess program.

When reverse-engineering an executable, you'll need a good disassembler or decompiler. Depending on what you use, you may get assembly-language or C code as the output. But note that this will not be commented code, and you will not see meaningful variable or function names. You'll have to read every line of code to determine what it does. And you'll quickly discover that the executable is the least of your worries. Excel's executable links in a number of DLL files, which would also need reverse-engineering.

To be successful, you will need an extensive knowledge of Windows programming in addition to C or Intel assembly code – not to mention a large amount of patience. Learning Access would be a much simpler task.

I'd be interested in why 32767 is insufficient for your needs. A database may make more sense, and it wouldn't necessarily need to duplicate the functionality of Excel. I store information in a database for output to Web pages, in which case I use HTML+JavaScript for anything that needs to be interactive.

1
  • 1
    Excel is a very practical, convenient format for sharing and editing data. It resembles data tables and offers very fast and easy way for humans to edit multiple data cells quickly, that no database or form application can match. We use it for exporting and importing relational DB data (heck, even for sending it in the backend from STAGING to PRODUCTION in an atomic way) and just stumbled on this cell limit. At least it is good to know that it's limitation of the app and not the file format, hopefully it's fixed in the future (even notepad supports single "cell" with 512MB data ;-) )
    – Ekus
    Sep 11, 2020 at 15:24
4

In case anyone is still having this issue:

I had the same problem with generating a pipe-separated file of longitudinal research data. The header row exceeded the 32767 limit. Not an issue unless the end-user opens the file in excel. Work around is to have end-user open file in google sheets, perform the text-to-columns transformation, then download and open file in excel.

https://support.clarivate.com/ScientificandAcademicResearch/s/article/Web-of-Science-Length-limit-of-cell-contents-in-Excel-when-opening-exported-bibliographic-data?language=en_US

1

Jack Straw from Wichita (https://stackoverflow.com/users/10327211/jack-straw-from-wichita) surely you can do an import of a pipe separated file directly into Excel, using Data>Get Data? For me it finds the pipe and treats the piped file in the same way as a CSV. Even if for you it did not, you have an option on the import to specify the separator that you are using in your text file.

Kind regards

Sefton Hall

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.