all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Importing tab-delimited text files or connecting to ODBC
@ 2006-02-16  8:44 Maks Romih
  2006-02-16 23:33 ` Markus Triska
  2006-02-17  0:04 ` Thien-Thi Nguyen
  0 siblings, 2 replies; 10+ messages in thread
From: Maks Romih @ 2006-02-16  8:44 UTC (permalink / raw)


Hi all!

I have a question about lisp in Emacs for Windows

What would be the best way to import some tables, like a tab delimited
copy-paste chunk from excel. I would like to get the table into Emacs
Lisp so that a table would be a big list of rows, where a row would be
a list of atoms, either raw strings or, when possible, converted to
Lisp numbers and symbols.

I'm considering programming some low level function like

    >(defun read-tab-delimited (fn)
    >  (find-file fn)
    >  (let (row rows)
    >    (while (re-search-forward "\\([^	
    >]*\\)\\([	
    >]\\)" nil t)
    >      (let ((token (match-string 1)))
    >	(push token row)
    >	(when (equal (match-string 2) "
    >")
    >	  (push (nreverse row) rows)
    >	  (setq row nil))))
    >    (kill-buffer nil)
    >    (nreverse rows)))
    
but I don't like it. I would still have a lot to work with converting
strings into numbers, converting pairs of double quotes into single
quotes, etc.

It would be much better if I could somehow call ODBC from emacs.  Then
I would simply connect to some Microsoft Access MDB or any other
relational database, and pump the data from there.

If the ODBC is impossible to call from emacs, I would maybe use CLISP
and CLSQL to connect to ODBC, convert the data and then load data into
emacs with the Elisp function read. I'm not sure if CLSQL and CLISP
for Cygwin works, this I'm going to ask on the comp.lang.lisp.

If someone of you had similar problems and have some idea, I would be
greatly thankful for any suggestions.

Maks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-02-18 18:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-16  8:44 Importing tab-delimited text files or connecting to ODBC Maks Romih
2006-02-16 23:33 ` Markus Triska
2006-02-17 12:19   ` Maks Romih
2006-02-17  0:04 ` Thien-Thi Nguyen
2006-02-17 14:29   ` Maks Romih
2006-02-17 16:35     ` Eric Pement
2006-02-17 17:01       ` Maks Romih
2006-02-17 19:06         ` Tim McNamara
2006-02-18 18:25           ` Peter S Galbraith
2006-02-18  5:53     ` Thien-Thi Nguyen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.