emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: Re: export only certain columns of an org-table to csv
Date: Sun, 09 Apr 2023 11:38:10 +0200	[thread overview]
Message-ID: <87y1n18kfx.fsf@mat.ucm.es> (raw)
In-Reply-To: 87edoto2v7.fsf@localhost

[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]

>>> "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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

  reply	other threads:[~2023-04-09  9:39 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 [this message]
2023-04-14 12:03     ` Ihor Radchenko
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=87y1n18kfx.fsf@mat.ucm.es \
    --to=oub@mat.ucm.es \
    --cc=emacs-orgmode@gnu.org \
    /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).