Closed JustSaX closed 1 year ago
No, there is not. \csvautotabular
displays the first line separated as header, but the usage is quite restricted.
However, with option no head
, the first line is available as data line and may be specially formatted with \ifcsvfirstrow
or methods from packages like tabularray
, see page 56:
Hi, thanks for your help. Would be the same possible with tabular
and booktabs
instead of tabulararray
?
I tried the following but I don't get bold a bold headerline:
% main.tex
\documentclass{article}
\usepackage[l3]{csvsimple}
\usepackage{booktabs}
\begin{document}
\csvreader[
no head,
tabular = rcc,
table head = {\toprule},
table foot = {\bottomrule},
late after first line = {\\ \midrule}
]{data.csv}{}{
\ifcsvfirstrow
{\textbf{\csvcoli}&\textbf{\csvcolii} & \textbf{\csvcoliii}}
{\csvcoli & \csvcolii & \csvcoliii}
}
\end{document}
This should (and does) work with version 2.3.2. Older versions contained a bug, see https://github.com/T-F-S/csvsimple/issues/23, so I guess your version is too old (?).
Thanks T-F-S updating my csvsimple version helped.
Is there an option to automatically create column headers from the first line of a csv file?
I did not spot it in the documentation.
Thanks for your help.