exporting from emacs to excel

Skip to first unread message


Jan 14, 2009, 6:13:35 AM1/14/09
I want to write a bit of elisp to take a file/buffer in org-mode and
export the tables to an excel sheet.

I know (very little) of how to write the code to make an excel sheet
from wscript. eg
giving wscript the following, opens a blank excel sheet:

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True

Is there some easy/natural way to get this functionality inside elisp?

Paul R

Jan 14, 2009, 7:42:34 AM1/14/09
to help-gn...@gnu.org

rustom> I want to write a bit of elisp to take a file/buffer in org-mode
rustom> and export the tables to an excel sheet.

You can maybe export as Coma Separated Values, then import into your
spreadsheet software.

Also, some high quality free spreadsheets are available for use. Check
OpenOffice Calc and Gnumeric.


Colin S. Miller

Jan 14, 2009, 3:12:57 PM1/14/09

That is using DDE/OLE to control Excel. OLE (Object Linking and Embedding)
uses DDE (Dynamic Data Exchange) to send messages between the applications.

A very quick google reveled http://www.stat.uiowa.edu/~luke/xls/wxls/wxls/node12.html
You might want to use DDESpy (part of Visual Studio) to see what your VB app is sending to Excel.
However, that elisp module might not support enough of DDE to implement OLE.

Colin S. Miller

Replace the obvious in my email address with the first three letters of the hostname to reply.

Xah Lee

Jan 14, 2009, 3:21:19 PM1/14/09

dont know what's wscript.
Wikipedia says http://en.wikipedia.org/wiki/Windows_Script_File

but if all you want is export some text formatted as some table in
emacs to excell, that's really easy elisp.

i dont use org-mode, so i'm not sure what format is its table. But
basically, a table is just text with special markers to indicate row
and column beginnings.

in ascii format, typically a row is just a line, and column are
delimited by comma. Typically known as csv format

all app or spreadsheet that deals with table data can import and
export this format.

if you can give a concrete example of what your source format is, then
perhaps me or others can show you the elisp code. It's probably just a
10 min job.



Jan 15, 2009, 1:56:02 AM1/15/09
Thanks Colin, Paul, Xah for the comments and tips.
Here are some clarifications.
excel is not a choice its a given; emacs-org is the choice!

The context: Our organization has a web-based system for logging hours
which can be slow at times.
It has a facility to upload the hours in an xls format so thats where
the given comes from.

So csv also is not an option in itself except as a hopping point
between emacs and xls.
Assuming I use that hopping point the task breaks up into 3:
1. Write elisp code to scrape an org mode file containing hours
clocked (in a suitable format) and write it to a csv file (in a
corresponding format)
2. Write a wscript script to read in the csv into excel and write it
out as xls
3. Write a ??? script to upload the output of 2 to the server

Even if we ignore 3, I was seeing what it would take to combine 1 and
2 into a 'one-click' solution (rather one-M-x solution) that would
convert my org record into an xls file.

Xah: Ive not really thought about 1 (and perhaps the better place to
pursue it would be the org mode list). I will do that if the other
parts seem workable.

Colin: The link you sent seems to be some other lisp? Or does it work
in elisp?

Reply all
Reply to author
0 new messages