2

I try to load a .csv into my .tex using datatool, but it uses only the first given key and I just don't get why.

first lines of my example foobar.csv:

1;a;ax
2;b;be
2;c;ck
3;d;do

(at the end the last column will be filled with picture.jpg, that will be loaded into a tkizpicture and it works fine if I take only the last column. The same applies for the other columns they will have a special action that works fine if I take only that one column.)

mwe:

\documentclass{standalone}
\usepackage{datatool}
\DTLloaddb[noheader,keys={1,2,3}]{foobar}{foobar.csv}
\begin{document}
\DTLdisplaydb{foobar}
\end{document}

it isn't giving an error, as I don't use the key in this example, but it isn't printing the keys 2 and 3, but only 1. It is printing the three columns perfectly, but not the keys. If I use the key in a more complex example I get the error:

foobar.tex:51: Package data tool Error: Can't assign \Title : there is no key '2' in data base 'foobar'.

thanks for your help!

3

the solution is quite easy, just had to add

\DTLsetseparator{;}

before

\DTLloaddb[noheader,keys={1,2,3}]{foobar}{foobar.csv}

as the separator seemed to be the problem.

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.