About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Latest news 2019-12-05: new blog post "RSS Feeds and Other Notifications."


2.5.1 Sample CSV Files

Some of these files contains UTF-8 characters, so you'll also need to use:

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

(or just fontspec [76] for XeLaTeX) and make sure your text editor is set to UTF-8 encoding. The sample CSV files are as follows (you can download them from the examples page):

  1. booklist.csv (download)

    This is a list of sample book titles. They could represent, say, products in a shop or a reading list for students. The id column provides a number that uniquely identifies the book. (This would typically be an ISBN in a real life book list or the ISBN might be in an additional column.)

    id,title,author,format,price
    1,"The Adventures of Duck and Goose","Sir Quackalot",paperback,10.99
    2,"The Return of Duck and Goose","Sir Quackalot",paperback,19.99
    3,"More Fun with Duck and Goose","Sir Quackalot",paperback,12.99
    4,"Duck and Goose on Holiday","Sir Quackalot",paperback,11.99
    5,"The Return of Duck and Goose","Sir Quackalot",hardback,19.99
    6,"The Adventures of Duck and Goose","Sir Quackalot",hardback,18.99
    7,"My Friend is a Duck","A. Parrot",paperback,14.99
    8,"Annotated Notes on the ‘Duck and Goose’ chronicles","Prof Macaw",ebook,8.99
    9,"‘Duck and Goose’ Cheat Sheet for Students","Polly Parrot",ebook,5.99
    10,"‘Duck and Goose’: an allegory for modern times?","Bor Ing",hardback,59.99
    This file can be loaded using:

    \DTLloaddb{books}{booklist.csv}

  2. people.csv (download)

    This is a list of sample people. They could represent, say, customers or students or members of an organization. The id column provides a number that uniquely identifies the person. (For example, a student's registration number.) The subscribed field indicates whether the person wants to be subscribed to some form of mailing list where a value of 1 means they want to be subscribed. The gender column can be either “m” (male) or “f” (female). The dob column is the date of birth in the ISO format ⟨year⟩-⟨month⟩-⟨day⟩.

    id,forenames,surname,title,address1,address2,town,county,country,postcode,subscribed,gender,dob
    1,Polly,Parrot,Miss,42 The Lane,,Some Town,Noshire,gb,AB1 2XY,1,f,1970-12-31
    2,Mabel,Canary,Mrs,24 The Street,Some Village,Some Town,Noshire,gb,AB1 2YZ,0,f,1968-01-23
    3,Zöe,Zebra,Ms,856 The Avenue,,Some City,CA,us,123456,1, f,1989-07-16
    4,José,Arara,,Nenhuma Rua,,São Paulo,,br,123457,1,m,1991-05-30
    5,Dickie,Duck,Mr,1 The Street,Another Village,Some City,Imagineshire,gb,YZ1 2AB,0,m,1952-11-25
    6,Fred,Canary,Mr,24 The Street,Some Village,Some Town,Noshire,gb,AB1 2YZ,1,m,1967-08-04
    This file can be loaded using:

    \DTLloaddb{people}{people.csv}

  3. country-codes.csv (download)

    This is a list of country codes. It contains 250 lines. You can download the entire file from the examples page. For brevity, only the header row and the rows containing codes that are referenced in people.csv are shown below:

    code,name
    br,Brazil
    gb,United Kingdom
    us,United States
    This file can be loaded using:

    \DTLloaddb{countries}{country-codes.csv}

  4. ordergroups.csv (download)

    This is a list of customer orders. The first column is a number that uniquely identifies the order, the second column is a cross-reference to the id field in the people.csv file above, indicating the purchaser, the third column is a discount applied to the order, and the fourth column is the cost of postage and packaging.

    id,customerid,discount,postage
    1,2,0,5.00
    2,4,2.50,20.00
    3,1,0,5.00
    (In practice, this would typically have extra fields, such as the dispatch status and order date.)

    This file can be loaded using:

    \DTLloaddb{ordergroups}{ordergroups.csv}

  5. orders.csv (download)

    This is a list of partial customer orders. Each row represents part of an order for one of the book titles listed in booklist.csv by one of the people listed in people.csv. There are four columns: the first is a number that uniquely identifies each order part, the second is a number that identifies the entire order (matching the id field in ordergroups.csv), the third column is a cross-reference to the id field in the booklist.csv file above, and the fourth column is the quantity ordered.

    id,groupid,bookid,quantity
    1,1,6,1
    2,1,1,4
    3,2,10,1
    4,2,7,20
    5,2,8,1
    6,3,1,4
    7,3,6,5
    8,3,7,2
    The first two rows form a single order (id 1 from the ordergroups.csv file). The order consists of two parts: one copy of the book whose id is 6 (the hardback version of “The Adventures of Duck and Goose”) and four copies of the book whose id is 1 (the paperback version of “The Adventures of Duck and Goose”). The next three rows form another order (id 2 from ordergroups.csv). The order consists of three parts: one copy of the book whose id is 10, twenty copies of the book whose id is 7 and one copy of the book whose id is 8. The last four rows form the third order (id 3 from ordergroups.csv). The order consists of three parts: four copies of the book whose id is 1, five copies of the book whose id is 6 and two copies of the book whose id is 7.

    This file can be loaded using:

    \DTLloaddb{orders}{orders.csv}


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-07-4).

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs