11

Is there any way to view / edit Excel spreadsheets (e.g. xls and xlsx files) in Emacs?

What about csv files? (e.g. column-aligning content).

For reference, this is what I see when I try to open an .xlsx files in Emacs:

M Filemode      Length  Date         Time      File
- ----------  --------  -----------  --------  --------------------------
  -rw-------    842825   7-Jan-2015  09:28:42  xl/worksheets/sheet1.xml
  -rw-------       550   7-Jan-2015  09:28:42  xl/workbook.xml
  -rw-------    313346   7-Jan-2015  09:28:42  xl/sharedStrings.xml
  -rw-------       784   7-Jan-2015  09:28:42  docProps/app.xml
  -rw-------       592   7-Jan-2015  09:28:42  docProps/core.xml
  -rw-------      1167   7-Jan-2015  09:28:42  [Content_Types].xml
  -rw-------      1403   7-Jan-2015  09:28:42  xl/styles.xml
  -rw-------      6994   7-Jan-2015  09:28:42  xl/theme/theme1.xml
  -rw-------       587   7-Jan-2015  09:28:42  _rels/.rels
  -rw-------       697   7-Jan-2015  09:28:42  xl/_rels/workbook.xml.rels
- ----------  --------  -----------  --------  --------------------------
               1168945                         10 files
  • 1
    I don't think you can edit a MicrosoftExcel file in Emacs -- editing it would likely break the ability of MicrosoftExcel to open and read it again without errors. In terms of just viewing them, see this link: emacswiki.org/emacs/UnXls – lawlist Feb 3 '15 at 21:58
  • 2
    Regarding CSV files, M-x package-install RET csv-mode RET (it's in the default GNU ELPA). – phils Feb 3 '15 at 23:25
  • I'd start by converting XSL to CSV. Look into your package manager for xls2csv (eg. yum search xls2csv or apt-cache search xls2csv) also look here: stackoverflow.com/questions/10557360 for other solutions. Dealing with CSV should be easier. – wvxvw Feb 4 '15 at 6:41
6

You may want to look at the following:

http://www.emacswiki.org/emacs/SpreadSheet

It provides many ways to view spreadsheets. I personally like OrgMode: http://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.html

To view MS xls files specifically, it suggests UN Xls, which is a "small piece of ugly code" that will "convert the Microsoft Excel crud to HTML, and convert the HTML to plain text." So you should be able to view the files, but you won't be able to edit them.

  • 2
    The solutions shouldn't simply be links to external websites. Also, these links don't solve the OP's question of how to edit .xls(x) in emacs. This could better serve as a comment to the question. – Kaushal Modi Feb 3 '15 at 22:21
  • That is true, I believe you need 50 reputation to post a comment. – gkumar7 Feb 3 '15 at 22:25
  • 2
    The question was about viewing and editing. I think an answer which helps with either of those aspects is perfectly fine. – phils Feb 3 '15 at 23:20
  • 1
    @phils regardless of viewing or editing. There's a single mention to excel somewhat hidden inside one of those links. As is, these links are not about xls spreadsheets, and the answer needs a bit of expanding. – Malabarba Feb 3 '15 at 23:43
  • 1
    I have expanded on John John's answer to directly address the present question. While the edits are pending peer review, see emacswiki.org/emacs/UnXls – Brian Z Feb 4 '15 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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