0

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

\documentclass{article}
\usepackage{makeidx}
\usepackage{datatool}
\DTUoaddb[keys=c1,c2,c3]{ctext}{csvtext.csv}
\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}

the excell file

Edit : Clarification

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

the excell file the excell file

closed as unclear what you're asking by Troy, TeXnician, Maarten Dhondt, marsupilam, CarLaTeX Jul 1 '17 at 5:02

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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
  • To export to csv from excel – marsupilam Jun 29 '17 at 16:08
  • 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
3

With a lot of lines

per request

The output

enter image description here

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*}
\DTLloaddb[keys={c1,c2,c3}]{ctext}{csvtext.csv}
\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}

Original answer

It seems to work fine, modulo some typos.

The output

enter image description here

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*}
\DTLloaddb[keys={c1,c2,c3}]{ctext}{csvtext.csv}
\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

Not the answer you're looking for? Browse other questions tagged or ask your own question.