1

I am using csvsimple to read a CSV file into my document. Here is the document:

\documentclass[12pt]{article}

\usepackage{csvsimple}

\begin{document}

\begin{tabular}{|c|c|c|}
\hline 
Col1 & Col2 & Col3 \\ 
\hline 
\csvreader [head to column names]{csvtest.csv}{}
{
\a & \b & \c \\
} \\ 
\hline
\end{tabular}

\end{document}

Here is the CSV file:

a,b,c
1,2,3

And here is the result:

enter image description here

As you can see, there is a blank line at the bottom of the table. How can I remove it?

1 Answers1

2

Use csvreader for the entire table:

\documentclass[12pt]{article}

\usepackage{csvsimple}
\begin{filecontents*}{csvtest.csv}
a,b,c
1,2,3
\end{filecontents*}
\begin{document}

    \csvreader[tabular=|c|c|c|,
        table head=\hline Col1 & Col2 & Col3 \\\hline,
        late after line=\\, late after last line=\\\hline]%
        {csvtest.csv}{a=\a,b=\b,c=\c}%
        {\a & \b & \c}

\end{document}

enter image description here

CarLaTeX
  • 62,716