# display a csv file in LaTeX [closed]

How can I link a csv file, and display the data in separate columns ?

\documentclass{article}
\usepackage{makeidx}
\usepackage{datatool}
\begin{document}
\begin{table}
\begin{tabular}{clr}
\textbf{Software} & \textbf{Manufacturer} &
\textbf{Malware}
\DTLforeach{ctext}{
\cola=c1, \colb=c2, \colc=c3}{
\\
\cola & \colb & \colc}
\end{tabular}
\end{table}
\end{document}


## Edit : Clarification

Can I import data from the normal Excel file without placing the data in a row in the Excel file

• I tried to link the columns where the data is in table form in the latex but the result was that I did not get a table that prints the data – ali Jun 27 '17 at 7:24
• Can you post the relevant .csv file? – Andrew Swann Jun 27 '17 at 9:30
• I'm voting to close this question as off-topic because it is really about spreadsheet export. – marsupilam Jun 29 '17 at 16:11
• ... or spreadsheet import. Ali, you should open your file with Excel choosing "file delemited by" and set delimiter=, in the dialog boxes that appear, see here: support.office.com/en-us/article/… This question is off-topic here. – CarLaTeX Jul 1 '17 at 5:01

# With a lot of lines

per request

## The code

\documentclass[12pt,border=2pt]{standalone}
\usepackage{datatool}
\usepackage{filecontents}
\begin{filecontents*}{csvtext.csv}
Software,Manuf,Mal
323,lkj,jjkl
345,jk,asdf
455,kjafs,ssd
\end{filecontents*}
\begin{document}
~
\begin{table}
\begin{tabular}{|c|l|l|}
\hline
\textbf{Software} & \textbf{Manufacturer} & \textbf{Malware}
\DTLforeach{ctext}
{\cola=c1, \colb=c2, \colc=c3}
{\cr\hline \cola & \colb & \colc}
\cr \hline
\end{tabular}
\end{table}
\end{document}


It seems to work fine, modulo some typos.

## The code

\documentclass{standalone}
\usepackage{datatool}
\usepackage{filecontents}
\begin{filecontents*}{csvtext.csv}
Software,Manuf,Mal
323,lkj,jjkl
345,jk,asdf
455,kjafs,ssd
\end{filecontents*}
\begin{document}
~
\begin{table}
\begin{tabular}{clr}
\textbf{Software} & \textbf{Manufacturer} & \textbf{Malware} \\
\DTLforeach{ctext}
{\cola=c1, \colb=c2, \colc=c3}
{
\\
\cola & \colb & \colc
}
\end{tabular}
\end{table}
\end{document}

• This is not what you requested to do the process of linking the data from the Excel file and the data exists as it is in the default Excel columns – ali Jun 29 '17 at 15:20
• @ali Sorry, I don't understand what you mean. Please be more explicit as to what you want. – marsupilam Jun 29 '17 at 15:25
• Can we link the data in the Excel file as it is in the columns (to put between the data a chapter mark (,) because many of the tables in which we use the data are placed in separate columns rather than in a single column separated by the chapter mark (,) I put the picture of the Excel file and the data in it as illustrated and I want to make the latex table of this data located in several columns and not one column – ali Jun 29 '17 at 15:28
• @ali Sorry, I don't understand. Please edit your question and add a picture to show the exact output you want. – marsupilam Jun 29 '17 at 15:34
• @ali So you want vertical lines between columns ? – marsupilam Jun 29 '17 at 15:38