6

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?

3 Answers 3

12

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.

3
  • And - yay! - it does not prevent references to this table from working (e.g. from SRC blocks)
    – vitaly
    May 10, 2018 at 0:27
  • 2
    Maybe this worked but it doesn't work anymore with bleeding edge org mode. Commented out content is just... out.
    – memeplex
    Mar 23, 2019 at 21:12
  • 1
    As the previous comment noted, this answer doesn't work in new versions of Org. The highest-voted (second) answer does still work.
    – jirassimok
    Nov 23, 2019 at 17:45
11

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
6

@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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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