2

Is there a way to export an org-mode table to a file without running the interactive org-table-export command from emacs?

I often use org-mode to create tables that I then export either to latex for inclusion in my main latex file or to csv for import into R for further processing.

I suspect that this could all be handled using a dynamic document that uses org-babel. But I find keeping R code and text separate and using make simpler, so would like way to export these tables programmatically so that I could make sure the latest version is updated before compiling my final text or running my R analysis.

So I'm looking for a way to run org-table-export on a specified file from the shell (that way I could put it in a makefile or in an R script).

I think I can run an elisp function from the command line using --batch --eval like here: https://stackoverflow.com/a/11475245/1072349, but I don't know enough elisp to write the function to pass a file to org-table-export.

1 Answer 1

2

From looking into org-table-export the following should work:

(defun my-export-batch-function (my-org-file pos-inside-my-table my-org-table-saved-file)
  (find-file my-org-file)
  (goto-char pos-inside-my-table)
  (org-table-export my-org-table-saved-file))

Remains the Emacs batch-mode part

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.