18

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
Glorfindel
  • 234
  • 1
  • 5
  • 13
Amelio Vazquez-Reina
  • 5,157
  • 4
  • 32
  • 47
  • 2
    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: http://www.emacswiki.org/emacs/UnXls – lawlist Feb 03 '15 at 21:58
  • 4
    Regarding CSV files, `M-x package-install RET csv-mode RET` (it's in the default GNU ELPA). – phils Feb 03 '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: http://stackoverflow.com/questions/10557360 for other solutions. Dealing with CSV should be easier. – wvxvw Feb 04 '15 at 06:41

1 Answers1

8

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.

Brian Z
  • 2,863
  • 16
  • 22
gkumar7
  • 288
  • 1
  • 4
  • 4
    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 03 '15 at 22:21
  • 1
    That is true, I believe you need 50 reputation to post a comment. – gkumar7 Feb 03 '15 at 22:25
  • 4
    The question was about viewing *and* editing. I think an answer which helps with either of those aspects is perfectly fine. – phils Feb 03 '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 03 '15 at 23:43
  • Malabarba: Actually, that's partly my fault -- I've made the question more explicitly about Excel, because that's what the examples were about, and it seemed impractical for the scope of the question to extend to *all* spreadsheets. When John John posted this answer, the question *was* (seemingly) broader, however, so I've done John John something of a disservice. Perhaps those who have down-voted on that account might reconsider. – phils Feb 04 '15 at 00:13
  • 1
    I have expanded on John John's answer to directly address the present question. While the edits are pending peer review, see http://www.emacswiki.org/emacs/UnXls – Brian Z Feb 04 '15 at 02:10