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 this:


Thank you!


I think I found the answer of how to create a table based on a csv file. The name of the packages is actually csvtools.

  • 3
    csvtools is the old version of the package. The current version is indeed called datatool.
    – Alan Munn
    May 16, 2012 at 23:54

1 Answer 1


Assuming that the first row is the name of the columns, then you simply need to load the database via \DTLloaddb{myDB}{MyData.csv} where the file MyData.csv contains the contents as shown above, and the you can use the internal function \DTLdisplaydb{myDB} to print it as a table.

This table is very wide so I used the geometry package to extend the width of the paper. Here is the first few columns of the table:

enter image description here

If the first row is not the header row, then you can specify the key for each column as:

\DTLloaddb[noheader,keys={,ColW5, ColW6, ColW7}]{myDB}{MyData.csv}

where only keys for the first three columns have been included.



  • And if I don't want to take in consideration the first row? Because it has to be like w5 -> 5 to 6am. May 17, 2012 at 10:02

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.