I would like to use the pgfplotstable package in order to import data from a .csv file into a multi-page table.
I would like for the table to have:
- a caption above it and
- its header to repeat at the top of every page
It seems that I'm only able to have one or the other. I can import a table and have a caption or I can import a table and have the header repeat on every page. I can't get both to work at the same time. Here is my MWE, where data.csv is a 2 column csv file with enough data to fill multiple pages:
\documentclass{minimal}
\usepackage{pgfplotstable}
\usepackage{longtable}
\begin{document}
\pgfplotstabletypeset[
begin table=\begin{longtable},
every head row/.style={before row={%
\caption{This is a Table with Data}%
\label{tab:DataTable}
\endfirsthead
\hline
}, after row=\hline},
every nth row={1}{before row=\hline},
every last row/.style={before row=\hline, after row=\hline},
col sep=comma,
string type,
columns/A/.style={column name=\textbf{Column 1}, column type={|c}},
columns/B/.style={column name=\textbf{Column 2}, column type={|c}},
end table=\end{longtable}
]{data.csv}
\end{document}