Thanks for the quick response!

thats perfect!  

my hackish workaround is 

.. |surveyed| raw:: html
                      :file: surveyed.csv

where its only the single value I wanted to include.

On Wed, Dec 14, 2011 at 11:32 AM, David Goodger <> wrote:
On Wed, Dec 14, 2011 at 13:54, Justin Haynes <> wrote:
> So first off, I am way new to docutils!  I'm using sphinx to generate a
> document but I want to include data from csvs inline.
> For example:
> i want to read data from a file called surveyed.csv into a sentence that
> reads:
> The number of people surveyed was ___ .
> where the blank is the number contained in the first column of the second
> row of the csv.  if necessary, the csv can be output as a single number with
> no header or extra columns.
> I'm sure this is easy, but I'm at a loss!!

At first I was going to answer that it wasn't possible to include
external text inline. But then I thought of a way that might work, and
was pleasantly surprised when it did work. It's a bit convoluted, so
it's not surprising that you weren't able to figure out how. We'll use
the "include" directive [1]_ in conjunction with a substitution
definition [2]_ using "replace" [3]_.

.. [1] "include" directive:

.. [2] substitution definitions:

.. [3] "replace" directive:

There's no way for "include" to extract a specific column from a CSV
file. You can specify a range of lines to include, and there are other
options (see [1]_). So you'll probably have to adjust your input
source accordingly.

Assuming that the value to include is in a file called
"number-surveyed.txt", here's how to do it in your document:

.. |surveyed| replace::

  .. include:: number-surveyed.txt

The number of people surveyed was |surveyed|.

David Goodger <>