From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: org-table Row Count Formula Date: Wed, 30 Jul 2014 10:57:47 +0200 Message-ID: <871tt3cjg4.fsf@gmail.com> References: <877g2vl04h.fsf@quasar.esben-stien.name> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCPi5-0000mJ-6a for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 04:58:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCPhy-0001md-Vt for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 04:58:09 -0400 Received: from plane.gmane.org ([80.91.229.3]:51660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCPhy-0001mB-Pb for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 04:58:02 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XCPhx-0005KI-4S for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 10:58:01 +0200 Received: from e178189071.adsl.alicedsl.de ([85.178.189.71]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Jul 2014 10:58:01 +0200 Received: from tjolitz by e178189071.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Jul 2014 10:58:01 +0200 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: emacs-orgmode@gnu.org Esben Stien writes: > I'm trying to figure out how to get the number of rows in an org-table, > but I can't find this in the documentation. > > Anyone have an idea? As always, there might be some Org function for this, but otherwise here is a starting point: #+begin_src emacs-lisp (defun tj/count-tbl-rows (&optional tbl-as-lisp) "Return number of tbl rows for tbl at point." (interactive) (let ((rows (if tbl-as-lisp (length tbl-as-lisp) (length (org-table-to-lisp))))) (message "Table has %d Rows" rows) rows)) #+end_src #+results: : tj/count-tbl-rows #+NAME: nice-tbl | pretty | impressive | table | | pretty | impressive | table | | pretty | impressive | table | | pretty | impressive | table | | pretty | impressive | table | | pretty | impressive | table | #+header: :var data=nice-tbl #+begin_src emacs-lisp (tj/count-tbl-rows data) #+end_src #+results: : 6 -- cheers, Thorsten