Hi,
I am continuing to work on my marking stuff; it's working really well, actually.
I am currently importing a list of student names and emails from a csv file -- this is normally how I get the list of enrolled students. I have modified the defauly settings from our Universities CSV export so I get these files in the form:
Student Name,Email
Student One,
address@hiddenStudent Two,
address@hiddenI then parse this into a list, each element of which is itself a list ("Student One" "
address@hidden"), etc.
This is OK, but not very robust. I would like instead to set *properties*, in case the CSV file has some other ordering of fields. So I've tried this:
(defun parse-plist-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))
(let ((header (split-string (buffer-substring-no-properties
(line-beginning-position) (line-end-position)) ","))
)
(while (not (eobp))
(let ((line (split-string (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(count 0)
(new-plist '()))
(while (< count (length line))
(setq plist-new (plist-put new-plist '(nth count header) (nth count line)))
(setq count (1+ count)))
(push new-plist result)
(forward-line 1))))
(reverse result))))
(setq plist-new (plist-put new-plist '(nth count header) (nth count line)))