I have a table that spans several pages I will be including in an appendix that I would like to import into my LaTex document from a csv. I found the long table answer post very helpful: Importing CSV file as a table in Latex but file too long, but I get a random extra cell and/or row underneath the first column header that throws off the rest of the table, and sometimes repeats throughout. Here is a shortened example of my data and the commands I used. If you uncomment the color code, it is easier to see what appears to be an extra cell that is throwing everything off (also, see the interrupted table border on the right side). Does anyone have any suggestions? Thanks.
%SE_example.csv looks like this:
Policy 1,2000-2010,Text here,a
Policy 2,1999-2005,Text here,b
Policy 3,1995-2006,Text here,c
%LaTex Code:
\documentclass[12pt, english]{article}
\usepackage{csvsimple}
\usepackage{longtable}
\usepackage{caption}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{array}
\usepackage[hmargin=2.54cm, vmargin=2.54cm]{geometry}
%\usepackage[table]{xcolor}
%\definecolor{lightgray}{gray}{0.9}
%\let\oldlongtable\longtable
%\let\endoldlongtable\endlongtable
%\renewenvironment{longtable}{\rowcolors{2}{white}{lightgray}\oldlongtable} {
%\endoldlongtable}
\begin{document}
\renewcommand*{\arraystretch}{1.6}
\scriptsize
\captionsetup{font=small}
\begingroup
\obeylines%
\catcode`\,=4%
\def^^M{\\}%
\makeatletter%
\begin{longtable}{|p{6cm} p{1.3cm} p{7.5cm} p{1cm}|}%
\caption{Example} \label{table:policies}
\textbf{Name} & \textbf{Years}&\textbf{Description}&\textbf{Source}\endhead %
\hline
\@@input SE_example.csv
\end{longtable}%
\endgroup%
\end{document}


csvsimplefeatures? – egreg Jan 26 '15 at 21:11