From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: How to pass table to SRC block as strings only? Date: Thu, 19 Jan 2017 19:49:00 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="0-1734598366-1484884141=:1712" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUQCY-0005hP-Ps for emacs-orgmode@gnu.org; Thu, 19 Jan 2017 22:49:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUQCS-0006vl-G1 for emacs-orgmode@gnu.org; Thu, 19 Jan 2017 22:49:22 -0500 Received: from iport-acv3-out.ucsd.edu ([132.239.0.4]:31667) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUQCR-0006tg-Uc for emacs-orgmode@gnu.org; Thu, 19 Jan 2017 22:49:16 -0500 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" To: =?ISO-8859-15?Q?S=E9bastien_Brisard?= Cc: emacs-orgmode@gnu.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1734598366-1484884141=:1712 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Thu, 19 Jan 2017, Sébastien Brisard wrote: > Thanks Charles for this answer. Let me state the problem more clearly. > Number-like cells *are* converted to numbers (as best illustrated by > the example below (see the use of numberp), which might incur accuracy > loss (see below, the first row has a lot of significant digits). > I am not interested in the number representation of these cells, only > the string matters for my application. Due to this accuracy loss, > converting back the number to a string is not an option for me... > > Any ideas? Thanks! The usual resolution of table references will eventually use `org-babel--string-to-number' to do what its name suggests. You can write an elisp function to handle references as you wish and call them from :var arguments. A hackish way to do this for your case is to quash the action of `org-babel--string-to-number': #+BEGIN_SRC emacs-lisp (defun get-ref-strings-as-is (ref) (cl-letf (((symbol-function 'org-babel--string-to-number) (lambda (x) x))) (org-babel-ref-resolve ref))) #+END_SRC #+header: :var table=(get-ref-strings-as-is "table20170119") #+BEGIN_SRC emacs-lisp :colnames yes :results pp table #+END_SRC #+RESULTS: : (("row1" "12345678901234567890") : ("row2" "a") : ("row3" "b") : ("row4" "c")) You can look at `org-babel-ref-resolve' to get some ideas on how to do this more artfully. > Sébastien > > ===== begin example ===== > #+NAME: table20170119 > | col1 | col2 | > |------+----------------------| > | row1 | 12345678901234567890 | > | row2 | a | > | row3 | b | > | row4 | c | > HTH, Chuck --0-1734598366-1484884141=:1712--