* org-tables, export only certain column (csv)
@ 2020-06-24 11:48 Uwe Brauer
2020-09-05 8:47 ` Bastien
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Brauer @ 2020-06-24 11:48 UTC (permalink / raw)
To: emacs-orgmode
Hi
4 years ago Michael Brand provided the following nice solution, which as
far as I know is still not in master.
(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)))
What is this code does can be best explained with the following example
table
| / | <> | <> | <> | <> | <> | <> | / | / | <> |
| | Title | L | M | X | J | V | Obligation | Balance | Past Balance |
|---+------------+-------------+-------------+-------------+-------------+-------------+------------+---------+--------------|
| | Statistics | 11:00-12:00 | 12:00-13:00 | 12:00-12:00 | 12:00-13:00 | | | | |
| | PDE | 12:30-13:30 | | 13:00-14:15 | | 12:30-13:30 | | | |
|---+------------+-------------+-------------+-------------+-------------+-------------+------------+---------+--------------|
| | | | | | | | 21.8 | 2.58 | -0.6 |
When exporting to latex or html the columns Obligation and Balance, will
not be exported (the first one neither).
However his code does not work when exporting it to CSV
I tried the following code
(defun org-table-export-to-xlsx ()
(interactive)
(let* ((source-file (file-name-sans-extension (buffer-file-name (current-buffer))))
(csv-file (concat source-file ".csv")))
(save-excursion
(f-ox-filter-table-column-del nil))
(org-table-export csv-file "orgtbl-to-csv")
(org-odt-convert csv-file "xlsx")))
But all columns are exported.
Does somebody have an idea?
Thanks and regards
Uwe Brauer
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: org-tables, export only certain column (csv)
2020-06-24 11:48 org-tables, export only certain column (csv) Uwe Brauer
@ 2020-09-05 8:47 ` Bastien
0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2020-09-05 8:47 UTC (permalink / raw)
To: emacs-orgmode
Hi Uwe,
Uwe Brauer <oub@mat.ucm.es> writes:
> 4 years ago Michael Brand provided the following nice solution, which as
> far as I know is still not in master.
Please let us know if you find a generic solution for this, we could
then add it to worg/org-hacks.org or perhaps.
--
Bastien
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-05 8:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-24 11:48 org-tables, export only certain column (csv) Uwe Brauer
2020-09-05 8:47 ` Bastien
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).