3

While I enjoy the table mode of org and love the way I can work with the data in these tables with eg Python or R I am currently stuck with a simple problem: How can I exclude the table from being exported?

#+TBLNAME: data
| Col1 | Col2 | Col3 | Col4 | Col5 |
...
#+TBLFM: ...

While i do know where I would include the respective option when executing R code (here I write :exports results so that the source is hidden) and while I know that |: as an option should seal the deal:

#+OPTIONS:     H:2 num:t toc:t ::t |:f ^:t f:t tex:t

I still have my huge table in my document. What am I doing wrong?

8

Embed your table inside a COMMENT block thus:

#+BEGIN_COMMENT

#+TBLNAME: data
| Col1 | Col2 | Col3 | Col4 | Col5 |
...
#+TBLFM: ...

#+END_COMMENT

I use this method for defining tabular data which I then process to produce an exported diagram or plot.

  • And - yay! - it does not prevent references to this table from working (e.g. from SRC blocks) – vitaly May 10 '18 at 0:27
  • Maybe this worked but it doesn't work anymore with bleeding edge org mode. Commented out content is just... out. – memeplex Mar 23 at 21:12
7

Another smart way is adding :noexport: tag to the section header which includes the data table.

C-c C-q (org-set-tags-command), input "noexport" tag at the section.

If you want to export again, C-c C-q and delete :noexport: tag.

* Data Section not for export                  :noexport:

#+TBLNAME: data
| Col1 | Col2 | Col3 | Col4 | Col5 |
|------+------+------+------+------|
|    1 | 2    | 3    | 4    | 5    |
#+TBLFM: ...

* Analysis Section

#+BEGIN_SRC R :session *R* :results output :exports results :var tmp=data
tmp
#+END_SRC

#+RESULTS:
:   Col1 Col2 Col3 Col4 Col5
: 1    1    2    3    4    5
4

@Juancho's answer is nice if you want to exclude a specific table from export. If you want to exclude all tables, you can simply set the |: option:

#+OPTIONS: |:nil

Note that the value false is to be denoted by nil not f!

This sets the variable org-export-with-tables whose docstring is:

org-export-with-tables is a variable defined in `ox.el'. Its value is t

Documentation: Non-nil means export tables. This option can also be set with the OPTIONS keyword, e.g. "|:nil".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.