emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Loris Bennett <loris.bennett@fu-berlin.de>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: Import CSV file, remove columns, print table
Date: Fri, 13 Sep 2019 09:42:15 -0400	[thread overview]
Message-ID: <CAJ51ETobc1Vhu=LjnSFxXPqCnSR8660j0kdvbWicMGyO_8+0bA@mail.gmail.com> (raw)
In-Reply-To: <87r24knwwi.fsf@hornfels.zedat.fu-berlin.de>

[-- Attachment #1: Type: text/plain, Size: 2510 bytes --]

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 <loris.bennett@fu-berlin.de>
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.
>
>
>

[-- Attachment #2: Type: text/html, Size: 3560 bytes --]

  reply	other threads:[~2019-09-13 13:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 13:33 Import CSV file, remove columns, print table Loris Bennett
2019-09-13 13:42 ` John Kitchin [this message]
2019-09-16 12:45   ` Loris Bennett
2019-09-16 13:31     ` John Kitchin
2019-09-17 10:02       ` Loris Bennett
2019-09-13 14:23 ` Fraga, Eric

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ51ETobc1Vhu=LjnSFxXPqCnSR8660j0kdvbWicMGyO_8+0bA@mail.gmail.com' \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=loris.bennett@fu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).