emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Uwe Brauer <oub@mat.ucm.es>
Cc: emacs-orgmode@gnu.org
Subject: Re: export only certain columns of an org-table to csv
Date: Fri, 14 Apr 2023 12:03:06 +0000	[thread overview]
Message-ID: <87h6tin01x.fsf@localhost> (raw)
In-Reply-To: <87y1n18kfx.fsf@mat.ucm.es>

Uwe Brauer <oub@mat.ucm.es> writes:

> I asked a similar question three years ago, the first two columns are
> not exported because of this
>
> (add-hook 'org-export-before-processing-hook 'f-ox-filter-table-column-del)
>
> (defun f-ox-filter-table-column-del (back-end)
>    "Delete the columns $2 to $> marked as \"/\" on a row with \"/\" in $1.
>  If you want a non-empty column $1 to be deleted make it $2 by
>  inserting an empty column before or rearrange column order in
>  some other way. Make sure \"/\" is in $1 again after that."
>    (while (re-search-forward
>            "^[ \t]*| +/ +|\\(.*?|\\)?? +\\(/\\) +|" nil t)
>      (goto-char (match-beginning 2))
>      (org-table-delete-column)
>      (beginning-of-line)))
>
> But it is not working for the csv export  would be nice if it would

This one is tricky.
Table export is intentionally decoupled from general export settings:

6d2ab4071960f8a7f20138291424b468722ab522
Author:     Nicolas Goaziou <mail@nicolasgoaziou.fr>
org-table: Fix radio tables containing macros

* lisp/org-table.el (orgtbl-to-generic): Export macros as-is, even if
  they are undefined.
* testing/lisp/test-org-table.el (test-org-table/to-generic): Add test.

Radio tables are now using a minimal set-up for export.  In particular,
no macro is expanded, and no Babel code is executed.  If any of these is
needed, use `org-export-string-as' or `org-export-region-as' instead.

Reported-by: Mark Edgington <edgimar@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100621>

-----

I understand that the suggested `org-export-region-as' will not work
because we don't have ox-csv. And changing the way table export works
may cause unforeseen consequences.

I have to think how to approach this problem.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  reply	other threads:[~2023-04-14 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08 17:26 export only certain columns of an org-table to csv Uwe Brauer
2023-04-09  8:51 ` Ihor Radchenko
2023-04-09  9:38   ` Uwe Brauer
2023-04-14 12:03     ` Ihor Radchenko [this message]
2023-04-14 12:14       ` Uwe Brauer

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=87h6tin01x.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=oub@mat.ucm.es \
    /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).