[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Import CSV file, remove columns, print table
From: |
Loris Bennett |
Subject: |
Re: [O] Import CSV file, remove columns, print table |
Date: |
Mon, 16 Sep 2019 14:45:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi John,
Thanks - that's a nicely compact solution, albeit in the category
'source block' and in a language I'm not very skilled at :-)
I realise that I have slightly misstated the problem. The ID in the
imported CSV is just a key from the database - I don't need it on the
list of participants. However, it would be nice to number the
participants, who are sorted by surname.
How would I insert a column which just numbers the row?
Cheers,
Loris
John Kitchin <address@hidden> writes:
> You can do something like this:
>
> #+name: csv
> | ID | Name | Titel / Title | Vorname / First Name | Nachname /
> Surname | Institution |
> | 1 | Alice Apple | Fr./Ms. | Alice | Apple
> | Universität zum Apfel |
> | 2 | Bob Birne | Hr./Mr. | Bob | Birne
> | Pear University |
> | 3 | Carol Carrot | Prof. | Carol | Carrot
> | University of Veg |
>
> #+BEGIN_SRC emacs-lisp :var data=csv
> (let ((table (mapcar (lambda (row) (list (nth 0 row) (nth 4 row) (nth 3
> row))) data)))
> (setf (car table) (append (car table) '("Signature")))
> table)
> #+END_SRC
>
> #+RESULTS:
> | ID | Nachname / Surname | Vorname / First Name | Signature |
> | 1 | Apple | Alice | |
> | 2 | Birne | Bob | |
> | 3 | Carrot | Carol | |
>
> John
>
> -----------------------------------
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
> On Fri, Sep 13, 2019 at 9:36 AM Loris Bennett <address@hidden> wrote:
>
> Hi,
>
> I want to create a list of participants of an event which people can
> sign, so that I can record who actually turned up.
>
> From the registration website I can download a CSV file and import it
> into and org file:
>
> | ID | Name | Titel / Title | Vorname / First Name | Nachname /
> Surname | Institution |
> | 1 | Alice Apple | Fr./Ms. | Alice | Apple
> | Universität zum Apfel |
> | 2 | Bob Birne | Hr./Mr. | Bob | Birne
> | Pear University |
> | 3 | Carol Carrot | Prof. | Carol | Carrot
> | University of Veg |
>
> I would like to reduce this to
>
> | ID | Nachname / Surname | Vorname / First Name | Signature |
> | 1 | Apple | Alice | |
> | 2 | Birne | Bob | |
> | 3 | Carrot | Carol | |
>
> and then print it out as a LaTeX table.
>
> I can obviously write a source block of Python or R to do this, but can
> I manipulate the table more directly in Org?
>
> Cheers,
>
> Loris
>
> --
> This signature is currently under construction.
>
--
Dr. Loris Bennett (Mr.)
ZEDAT, Freie Universität Berlin Email address@hidden