I'm very unexperienced in Latex but I need to write a document that uses table from a csv file and I'm having a really hard time knowing how to do it. The main problems:
- If I include the header from csv the table is too wide and it has caracters that are now alowed such as "[", "]" and "`"; (Can I skip the header and write it myself? (The header is always the same but the content of the table changes from project to project))
- The table is too long to fit into a page; (Can't break it. Is there a way to say I just want these amount of rows for 1 page and then of to the next one?)
- The values have spaces before are substituted with "" (see image please);
- I have been trying to understand how longtable, tabularx, tabular and tabular* work, but to no avail, especially when I pair it with the csv part (below it's the only combination that has sort of worked for me)
\documentclass[a4paper,12pt]{article}
\usepackage{graphicx} % adds images
\usepackage{subcaption}
\usepackage{setspace} % set the spacing for individual parts of the document
\usepackage{booktabs}
\usepackage[a4paper, portrait, margin=2.5cm]{geometry} % defines margins
\usepackage{fancyhdr} % header and footer
\usepackage{lipsum} % imagens in header
\usepackage{pdfpages} % automatically numbers pdf pages
\usepackage{xcolor} % adds color to text
\usepackage[utf8]{inputenc}
\usepackage[default]{sourcesanspro} % adds a similar font to Myriad Pro
\usepackage[T1]{fontenc}% adds a similar font to Myriad Pro
\usepackage{stringstrings} % \substring{abcdefgh}{3}{6} gives me the 3rd to 6th char = "cdef"
\usepackage{currfile} % gets filename
\usepackage{csvsimple}
\usepackage{longtable} %separates tables
\usepackage{tabularx} %separates tables
%code that was online to change the date format
\def\mydate{\leavevmode\hbox{\twodigits\day-\twodigits\month-\the\year}}
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}
\pagestyle{fancy}
\fancyhf{} %elimina header e footer default
\renewcommand{\headrulewidth}{0pt} %elimina linha entre cabeçalho e texto
\renewcommand{\footrulewidth}{0pt}
\setlength\headheight{45.0pt}
\addtolength{\textheight}{-45.0pt}
\lhead{\includegraphics[width=6cm]{auxiliar/header.jpg}}
\rfoot{\textcolor{gray}{\thepage}}
\lfoot{\includegraphics[width=15cm]{auxiliar/footer.jpg}}
\begin{document}
\begin{tabularx}{\textwidth}{l *{6}{>{\centering\arraybackslash}X} }
\csvautotabular[separator=semicolon, respect all]{23.csv}
\end{tabularx}
\end{document}
%csv with headers content
Type;Nombre;Longueur [m];Poids unitaire [kG/m];Poids piece [kG];Poids total [kG];Surf. peinture [m2]
S 275;;;;;;
CAE 50x5;2;6,02;3,77;22,70;45;2,34
CAE 50x5;4;6,27;3,77;23,65;95;4,87
CAE 50x5;4;6,28;3,77;23,68;95;4,87
CAE 50x5;4;6,29;3,77;23,72;95;4,88
CAE 50x5;4;6,30;3,77;23,76;95;4,89
CAE 50x5;4;6,38;3,77;24,06;96;4,95
CAE 50x5;4;6,39;3,77;24,10;96;4,96
CAE 50x5;4;6,46;3,77;24,36;97;5,01
CAE 50x5;4;6,66;3,77;25,12;100;5,17
CAE 50x5;4;6,67;3,77;25,16;101;5,18
%csv without headers content
S 275;;;;;;
CAE 50x5;2;6,02;3,77;22,70;45;2,34
CAE 50x5;4;6,27;3,77;23,65;95;4,87
CAE 50x5;4;6,28;3,77;23,68;95;4,87
CAE 50x5;4;6,29;3,77;23,72;95;4,88
CAE 50x5;4;6,30;3,77;23,76;95;4,89
CAE 50x5;4;6,38;3,77;24,06;96;4,95
CAE 50x5;4;6,39;3,77;24,10;96;4,96
CAE 50x5;4;6,46;3,77;24,36;97;5,01
CAE 50x5;4;6,66;3,77;25,12;100;5,17
CAE 50x5;4;6,67;3,77;25,16;101;5,18





filecontentsenvironment. – NBur Feb 10 '21 at 12:22tabularxtable: (i) in document preamble add\usepackage{tabularx}, (ii) table define as\begin{tabularx}{\textwidth}{l *{6}{>{\centering\arraybackslash}X} } \csvautotabular[separator=semicolon, respect all]{23.csv} \end{tabularx}– Zarko Feb 10 '21 at 12:36(I'm sorry if it's a simple mistake, I haven't work with Latex before)
– Ana Cláudia Faria Feb 10 '21 at 12:40