emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: export only certain columns of an org-table to csv


From: Ihor Radchenko
Subject: Re: export only certain columns of an org-table to csv
Date: Fri, 14 Apr 2023 12:03:06 +0000

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 via email to

[Prev in Thread] Current Thread [Next in Thread]