How to run multiple compilations of a document with different CSV input files

Assuming that your .tex file is called mytable.tex, and looks like this:

\ifdefined\mycsvfile
\else
    \def\mycsvfile{csv1.csv}
\fi
\documentclass[a4paper,10pt]{article}
\usepackage{pgfplotstable, booktabs}

\begin{document}
\begin{center}

\pgfplotstabletypeset [
    col sep = comma,
    every head row/.style={before row=\toprule, after row=\midrule},
    every last row/.style={after row=\bottomrule},
    display columns/0/.style={string type}
    ]{\mycsvfile}

\end{center}
\end{document}

then you could use the following (Windows) batch file, bulkpdfs.bat

echo off

echo "batch compiling pdf files"
for %%f in (*.csv) do (
    echo compiling %%f ...
    pdflatex \def\mycsvfile{%%f}\input{mytable.tex} & copy mytable.pdf mytable%%~nf.pdf
)

pause

This will produce mytablecsv1.pdf, mytablecsv2.pdf, ...

For reference, see Two pdf versions from one single .TEX file?


Not sure if the code above is a short example or the actual document (from your wording I assume it's the actual one).

If you have multiple csv files — which for this solution must be named with the format csv#.csv, where # is a number — and if the tables all fit one single page without any particular problems, then you can use a loop to typeset them one per page. This answer shows an example of that, but of course, actual application might vary depending on the size of the tables.

Output (single pages)

1 enter image description here    2 enter image description here

Code

\documentclass[a4paper,10pt]{article}
\usepackage{pgfplotstable, booktabs}
\usepackage{filecontents}% just for this example
\usepackage{geometry}

\pgfplotsset{compat=1.13}
\pagenumbering{gobble}

% These two are just for this example. You should have external files anyway.
\begin{filecontents*}{csv1.csv}
Name,Number
Daniel,1
Mary,2
Sarah,3
\end{filecontents*}

\begin{filecontents*}{csv2.csv}
Name,Number
Jack,24
John,5
Matthew,32
\end{filecontents*}
%%%
\begin{document}
\foreach \x in {1,2}{% <-- if you have many csv, you can say e.g. {1,...,45}
    \pgfplotstabletypeset [
        col sep = comma,
        every head row/.style={before row=\toprule, after row=\midrule},
        every last row/.style={after row=\bottomrule},
        display columns/0/.style={string type}
        ]{csv\x.csv}%
    \newpage
}%
\end{document}

Here one way how you can do it:

\documentclass[a4paper,10pt]{article}
\usepackage{pgfplotstable, booktabs}

\pgfplotsset{compat=1.14}
\pagenumbering{gobble}

% Create your own command 
\newcommand\MyTable[1]{\pgfplotstabletypeset[
    col sep = comma,
    every head row/.style={before row=\toprule, after row=\midrule},
    every last row/.style={after row=\bottomrule},
    display columns/0/.style={string type}
    ]{#1.csv}\newpage
}

\begin{document}
\begin{center}

\MyTable{csv1}
\MyTable{csv2}

\end{center}
\end{document}