
Excel.vim - johannh
https://github.com/yakiang/excel.vim
======
ygra
»Works best on excel files that contain English characters only.«

That's a quite sad statement to make nowadays. I guess the old binary format
might be worse regarding character sets, but at least the newer ones should
use Unicode exclusively which makes this a very odd restriction.

~~~
deadweight3
I _hate_ this sentiment. I speak English and French and have limited amount of
time to hack on software I'm giving away for free. My day job consists
entirely in English. I have neither the experience, nor the inclination for
internationalization of software. Don't like, don't use it. Or fork it, and
add it yourself, because obviously you have more free time than I have.

~~~
pyre
> I have neither the experience, nor the inclination for internationalization
> of software.

Taking a piece of software and making all of the UI language localized is one
thing. Making sure that your program doesn't blow up if it encounters UTF-8 is
another thing. Nowadays if your program chokes on UTF-8, I think it's safe to
just consider it broken.

In any case, looks like this is really where the issue may lie:

    
    
      # for non-English characters
      def getRealLengh(str):
          length = len(str)
          for s in str:
              if ord(s) > 256:
                  length += 1
          return length
    

and:

    
    
              for val in shn.row_values(n):
                  try: val = val.replace('\n',' ')
                  except: pass
                  val = isinstance(val,  basestring) and val.strip() or str(val).strip()
                  line += val + ' ' * (30 - getRealLengh(val))
              vim.current.buffer.append(line)
    

In accounting for the fix-width layout of non-ASCII characters.

~~~
bobbyi_settv
Are UTF-8 encoded Excel documents actually common? Do they even exist? I
thought Excel used CP 1252 on English Windows and the corresponding code pages
on other language versions?

~~~
vertex-four
How would it save a document containing multiple languages, then?

~~~
sheetjs
Excel 97-2003 (XLS) actually uses UTF16LE in that case, not UTF8. Excel 2007+
XLSB exclusively uses UTF16LE -- there is no way to force it to use a codepage

------
dous
Thanks for sharing this. To the author, if you're reading this, thanks for
putting your work up on Github.

------
deadweight3
Working in a corporate world where an excel can often be how you receive bug
reports, this will actually fit very well into my workflow.

------
sheetjs
If the author is reading this:

> For vim 7.3 and less, it works well for almost all kinds of file formats,

> ie. .xls,.xlam,.xla,.xlsb,.xlsx,.xlsm,.xltx,.xltm,.xlt etc

Someone already pointed it out
([https://github.com/yakiang/excel.vim/issues/5](https://github.com/yakiang/excel.vim/issues/5))
on github: xlrd does not support the XLSB format (and the xlrd authors
expressed no interest in building it)

~~~
zzleeper
I just found out about XLSB.. if really saves me so much time / space, I might
just start using it for all large spreadsheets..

~~~
sheetjs
XLSB is significantly faster to process because it does not require an XML
parser to blast through the data. Numbers are stored directly as IEEE754
doubles. Text may end up larger because XLSB uses UTF16LE for everything,
including pure-ASCII strings (since Excel uses that format internally, there
is no conversion involved and XLSB still will be faster).

The problem you will encounter is that most programs (Numbers, Google Docs) do
not support XLSB.

Shameless plug: [https://github.com/SheetJS/js-
xlsx](https://github.com/SheetJS/js-xlsx) supports both XLSX and XLSB (AFAICT
the only liberally licensed project that handles the format)

------
kasbah
I could actually really use a nice display of CSV and TSV files (with
editing).

~~~
eggoa
There's code for a decent plugin here:

[http://vim.wikia.com/wiki/Working_with_CSV_files](http://vim.wikia.com/wiki/Working_with_CSV_files)

I'm not sure if it's what you're looking for, but I've found it very useful.

------
hk__2
Why make a Vim plugin instead of a standalone program since it’s read-only?

~~~
cowsandmilk
As a Vim plugin, you get a lot of features of Vim for free (e.g. search,
familiar bindings). And the code is only 56 lines. A stand-alone program would
likely have less features and be much longer.

------
fiatjaf
I think this could be greatly useful, as also sc could have been.

------
bibonix
I'll definitely try it... good idea

------
gdiocarez
Wow. How far will vim go if it can now replicate like excel?

