Questions tagged [datatool]

{datatool} is a tool to create and manipulate databases.

374 questions
20
votes
3 answers

Use datatool to read a row from a CSV file, then use the variables in the document?

I'm confused about how to use "datatool" to read variables from a row in my database, and pass them on to be formatted in my text. I don't want to make a table, but that's about all there seems to be examples of on the Internet. I have a CSV file…
user67287
  • 321
12
votes
1 answer

How to use datatool package to read a CSV files so that they can be used in tables?

I am new in latex and I have some issues. I want to read a .csv file in latex to create a table, but I don't know how. I heard that datatool package can do this, but I don't know how to use it. My input is smth like…
8
votes
1 answer

Datatool and currency-type data

The package datatool gives me some headaches with the currency-type fields. My data is a test.csv file exported from Excel, without header: a,"$100,090.06 ","$107,578.03 ",0.129565278 b,"$267,697.13 ","$72,463.54 ",0.087442318 c,"$761,314.81…
8
votes
4 answers

How to check if a datatool db has an existing member

I would like to suppress duplicated entries in a list. The lists are comma separated lists defined in a macro as in my earlier question on Sorting Comma Separated Lists defined with, or without macro. My current approach is to use the datatool…
Peter Grill
  • 223,288
8
votes
1 answer

datatool: getting a specific value given the value of another column

I am certain this is patently obvious, but the solution is eluding me... Given a dataset stored in CSV: ID, col1, col2, col3 KEY-1, foo bar, baz KEY-2, alice, bob, chuck I would like to define a macro \getCol3{KEY-2} that returns chuck. I…
8
votes
1 answer

Difficulty with datatool

I want to use the command \DTLstoreinitials from package \usepackage{datatool} in the following way : \newcommand{\extractInitials}[1]{% \DTLstoreinitials{#1}{\userInitials}% \DTLsubstituteall{\userInitials}{.}{}%remove points between the…
Loic Rosnay
  • 8,167
7
votes
1 answer

Datatool control precision

How can I bring down the number of decimal points in following code to only 2: \documentclass{article} \usepackage{datatool} \begin{filecontents*}{test2.csv} Name, Age, stDev Adam, 17.2344,…
sachinruk
  • 427
7
votes
2 answers

How to put content from multiple databases in one table using datatool?

Almost too easy: I have two databases "First" and "Second", both get their data from tab-delineated files "First.txt" and "Second.txt" Both contain two columns ('year' and 'number') and an equal amount of rows! This code…
6
votes
1 answer

accessing data using datatool when headers aren't available

I have a series of csv files I'm expecting to receive on a regular basis, and there are two problems with these files. I am not guaranteed to have headers. I cannot rely on how many data entries there will be per row (sometimes there may be 50 or…
A.Ellett
  • 50,533
6
votes
1 answer

Datatool DTLifnull not working

Considering the following database: Name,ID,Gender,Years in Service ,382473856,M,15 Francesca Joestar,461276432,F,10 Chan Ker Mei,463724631,F,5 Hikaru Yagami,154954739,M,10 The first line has the field "Name" empty. The following code does not…
6
votes
1 answer

File ended while scanning use of \@dtl@trim

I am trying to compile latex code that imports CSV into a longtable (ltxtable). The code has been compiled successfully in windows while it makes error in Mac OS X.…
Aydin
  • 1,983
6
votes
1 answer

How do I get the number of rows of a datatool table?

I create a table as follows: \usepackage{datatool} \begin{document} \DTLnewdb{MaTable} \end{document} This table may be filled with several occurrences of \DTLnewrow{MaTable} \DTLnewdbentry{MaTable}{key}{value} My question is: How can I get the…
Loic Rosnay
  • 8,167
6
votes
2 answers

Datatool - Fill Variable (name in first row) with value of second row

I have a csv with 2 rows. the first row contains names and the second row the value. i want to create variables (tried it with newcommand) that have the Name of the first row and define them with the value of the second row. the final csv will…
Jonas
  • 75
6
votes
1 answer

Datatool query database \dtlgetrowindex argument expansion

I am building a database to gather information from various places of my document. I would like to do the following: query database to look for a row with specific value for a key. If such a row is found (which should be unique by the construction…
5
votes
2 answers

Error with latest version of datatool package

With the latest version of the datatool package, if I compile this file \begin{filecontents*}{\jobname.csv} x,y …
1
2 3 4 5