From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: How to export table from a src block? Date: Mon, 28 Mar 2016 15:20:58 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akcil-00063Y-40 for emacs-orgmode@gnu.org; Mon, 28 Mar 2016 15:21:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akcih-0006VE-Ua for emacs-orgmode@gnu.org; Mon, 28 Mar 2016 15:21:03 -0400 Received: from mail-qg0-x22f.google.com ([2607:f8b0:400d:c04::22f]:35089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akcih-0006VA-Pz for emacs-orgmode@gnu.org; Mon, 28 Mar 2016 15:20:59 -0400 Received: by mail-qg0-x22f.google.com with SMTP id y89so116901623qge.2 for ; Mon, 28 Mar 2016 12:20:59 -0700 (PDT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: William Denton Cc: emacs-orgmode@gnu.org Try this: * Export table from src-block #+name: mytable | a | b | | 1 | 2 | | 3 | 4 | #+BEGIN_SRC emacs-lisp (save-excursion (org-open-link-from-string "[[mytable]]") (while (not (org-table-p)) (forward-line)) (org-table-export "mytable.csv" "orgtbl-to-csv")) #+END_SRC #+RESULTS: : Export done. #+BEGIN_SRC sh cat mytable.csv #+END_SRC #+RESULTS: : a,b : 1,2 : 3,4 William Denton writes: > I have a big table (with #+NAME: mytable). I can export it to a CSV file by > hand by having the point somewhere in the table and running > > M-x org-table-export > > but how could I do this from a source block? I've got one line so far, but how > would I get it to be in the table when it runs? There's nothing else in this > file, just a table and then this source block. > > #+BEGIN_SRC emacs-lisp > (org-table-export "/tmp/mytable.csv" "orgtbl-to-csv") > #+END_SRC > > Any help appreciated! > > Bill -- 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