5

I have a file whose contents I would like to view dynamically from a generic Org-mode buffer.

For example, suppose I have a file called data.csv, and I'd like to display some of its contents when I visit study.org. To make up one way that this might look, study.org might appear as follows:

# -*- mode: Org; coding: utf-8; -*-
...
#+INCLUDE: "data.csv" :head 5
#+BEGIN_INCLUDE
id,name,count
1,recursion,48
2,exercise,55
3,ambrosia,85
4,division,16
#+END_INCLUDE
...

I see that someone has asked this question in the context of the Org-mode export mechanism (How to embed external file contents in org file?), but I don't see a way to include external file content in an Org buffer.

Does Org-mode support this sort of thing?

4

you can use a shell source code block

#+BEGIN_SRC sh :results output drawer
head -n 5 data.csv
#+END_SRC

Then you hit C-c C-c inside the block and run the source code which will show below the first five lines of the file in a results block

  • I was hoping for something a little more integrated and less hacky, but this does the job! – aparkerlue Nov 7 '17 at 1:53

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.