Skip to content

Instantly share code, notes, and snippets.

@syohex
Created April 30, 2013 09:49
Show Gist options
  • Save syohex/5487731 to your computer and use it in GitHub Desktop.
Save syohex/5487731 to your computer and use it in GitHub Desktop.
very simple csv parser in emacs lisp
(require 'cl)
(defun parse-csv-file (file)
(interactive
(list (read-file-name "CSV file: ")))
(let ((buf (find-file-noselect file))
(result nil))
(with-current-buffer buf
(goto-char (point-min))
(while (not (eobp))
(let ((line (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(push (split-string line ",") result))
(forward-line 1)))
(reverse result)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment