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: Uwe Brauer
Subject: Re: export only certain columns of an org-table to csv
Date: Sun, 09 Apr 2023 11:38:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>>> "IR" == Ihor Radchenko <yantar92@posteo.net> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>> I have the following simple table
>> 
>> 
>> #+Name: table
>> | / | /      | <>     | <>     |
>> |   | Name   | Sheet1 | Sheet2 |
>> |---+--------+--------+--------|
>> |   | Smith  | Ex1    | Ex2    |
>> |   | Miller | Ex3    | Ex4    |
>> 
>> 
>> I hoped that the first two columns would not be exported to csv
>> (orgtbl-to-csv), indeed they are not when exporting to latex or html but
>> for csv, all columns have been exported.

>> What do I miss?

> The second column get exported to latex and html on my side.
Well, well memory fails.
https://list.orgmode.org/874koc38zn.fsf@gnu.org/T/

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

> And it is expected. Only the first column with spacial marks does not
> get exported. All other columns are exported, unless you specify
> :skipcols (see `orgtbl-to-generic' docstring).

-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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