I have a csv like the following:
CategoryName,Pageviews
Restaurants,37951
Shopping,22002
Things to do,20067
Nightlife,10612
Gifts,9194
Food Shopping,8655
Useful Stuff,8536
Parenting ,8353
Home,7654
Fitness,6623
Event & Party Planning,6387
Sports,4351
Health & Wellness,4201
Women's Beauty,3807
Pets,2923
Vehicles,2492
Male Grooming,2339
Hotels & Rentals ,2332
Charities,364
I'm using
\usepackage{csvsimple}
to read the csv and print it as a table with the following code.
\csvautotabular{cats.csv}
which doesn't work.
I've tried also
\begin{tabular}{l|c}%
\bfseries Category & \bfseries Metric
\csvreader[head to column names]{cats.csv}{}
{\\\hline\CategoryName\ & \metric}
\end{tabular}
And that also doesn't work, I have a hunch that it's because of the whitespace in the CategoryName field. Any workarounds for this problem without deleting the whitespaces? I can't find a solution in the csvsimple
manual.
! Incomplete \if; all text was ignored after line 6. <inserted text> \fi l.6 \csvautotabular{cats.csv}
. Also, it is great that you included the snipplets, but generally we prefer minimum working examples for diagnosis. – Willie Wong May 24 '16 at 14:15