2

I have successfully used csvsimple to import .csv files. But I would like to have commas as number separators, so I modified the .csv file to use semicolons as separators and as csvsimple manual says, I defined it with separator=semicolon like this

\begin{tabular}{c|c c|c}%
  & \bfseries A & \bfseries B & \\\hline
  \csvreader[head to column names, late after line=\\, separator=semicolon]%
  {csv/test.csv}{}%
  {\bfseries\cat & \A & \B & \acc\%}%
\end{tabular}

but I keep getting error ! Package pgfkeys Error: I do not know the key '/csv/separator' and I am going to ignore it.

  • 1
    Hi, and welcome to TeX.sx. Can you please turn this into a complete compilable document that produces the error. When I construct such an example, it works. – Alan Munn Jun 21 '14 at 1:04
  • 3
    What version of csvsimple are you using? According to the CHANGES file, separator was introduced in version 1.07. – Nicola Talbot Jun 21 '14 at 17:17
  • Package: csvsimple 2012/11/08 version 1.06 LaTeX CSV file processing. you are right. I knew, that the version is quite new from last year, but I didn't realize that Ubuntu 13.10 has older versions in repositories... thanks – betatester07 Jun 23 '14 at 11:27
3

I used /csv/separator=semicolon instead of separator=semicolon and it worked.

  • 3
    Please add a compilable MWE for an easy proof of the op. That's the usual way here to make an good answer. Welcome! – Mensch Feb 26 '16 at 21:17
  • Thank you. But I don't get it, can you explain? – Nicholas Feb 29 '16 at 12:51
1

Maybe this helps:

enter image description here

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{datatool}

\usepackage{filecontents}
\begin{filecontents*}{mydata.csv}
a1;b1;c1;d1
a2; "b21 and b22";c2;d2
\end{filecontents*}

\DTLsetseparator{;}
\DTLloaddb[
  noheader,
  keys={A,B,C,D}
  ]{mydb}{mydata.csv}
%=======
\begin{document}
%=======

\DTLforeach*{mydb}{\A=A,\B=B,\C=C,\D=D}{
  \section{\A}
\begin{tabular}{c|c c|c}%
  & \bfseries \A & \bfseries \B & \\\hline
   \bfseries \C & Y & Z 
\end{tabular}
 }
%=======
\end{document}
%=======
  • This doesn't really answer the question, which deals with the csvsimple package, not datatool. Since both are fine packages, it's not clear that suggesting someone switch is really appropriate. – Alan Munn Jun 21 '14 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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