I am using datatool package. Several csv files with data are generated in my project and I create index.csv to use Nested \ DTLforeach.
I do not understand how I can assemble a 3x3 / 3x4 or 3x5 matrix depending on the number of csv files.
\documentclass[a4paper]{article}
\usepackage{pgf}
\usepackage{pgffor}
\usepackage{datatool}
\begin{document}
\begin{filecontents}{index.csv}
File
1.csv
2.csv
3.csv
4.csv
5.csv
6.csv
7.csv
\end{filecontents}
\begin{filecontents}{1.csv}
Header 1
image 1
description 1
\end{filecontents}
\begin{filecontents}{2.csv}
Header 2
image 2
description 2
\end{filecontents}
\begin{filecontents}{3.csv}
Header 3
image 3
description 3
\end{filecontents}
\begin{filecontents}{4.csv}
Header 4
image 4
description 4
\end{filecontents}
\begin{filecontents}{5.csv}
Header 5
image 5
description 5
\end{filecontents}
\begin{filecontents}{6.csv}
Header 6
image 6
description 6
\end{filecontents}
\begin{filecontents}{7.csv}
Header 7
image 7
description 7
\end{filecontents}
\begin{tabular}{p{86pt} p{86pt} p{86pt}}
\hline
\DTLloaddb{index}{index.csv}
\DTLforeach{index}{\theFile=File}{
\DTLloaddb{\theFile}{\theFile}
\DTLforeach{\theFile}{\theHeader=\theFile}{\theHeader & \theHeader & \theHeader \\}
}
\end{tabular}
\end{document}
How can a matrix be formed so that it detects the heading of each csv file and substitutes it in the tabular environment. I have no idea how to achieve this result, thank you for any help.
