Search code examples
vimnotepad++xlsx

Open xlsx with vim


I'm frequently getting .xslx files and do not have the newest Excel to open. Open Office takes too long to open them as does converting software for older Excel versions.

So, I want to open the xlsx file using vim (or maybe notepad++). However, apparently it is not stored as standard text, so trying to open it results in random characters.

Is there some way I can get vim or Notepad++ (or some other text editor) to open an XLSX file?


Solution

  • XLSX is just a zip of a bunch of XML files, so you could unzip them and view the XML, but that isn't going to get you very far, because the XML itself is not all that easy to read. My experience with it isn't extensive, but basically, in worksheets with formulas and numbers, you'll see an XML file for each sheet, containing an element for each cell with information about the cell and what it contains (<f> tags for functions, v for value), except if the cell contains a string, the value is a number referencing it to sharedStrings.xml, which contains basically a list of all unique strings in the entire workbook. I don't see an easy way to just open it up and read the contents the way you seem to want to.

    It's possible that converting the xlsx file to something simple like CSV may be faster than trying to convert it to xls, which is a different binary format, but I don't know. Another option is rolling your own conversion program using something like Perl's Spreadsheet::XLSX. I don't know how much this will help you, but hopefully you can get enough information from this to know where to look next.