TransWikia.com

CSV: How to write commas

TeX - LaTeX Asked on May 23, 2021

I have a CSV document, similar to the one in the example code.

documentclass[a4paper,12p]{article}

usepackage[textwidth=450pt, textheight=680pt,top=3cm, left=2.5cm]{geometry} %margins

usepackage{tabularx}
usepackage{csvsimple}

newcommandmce{multicolumn{1}{c}{}}
newcounter{Rownumb}
newcounter{Rownumbe}
usepackage{siunitx}

usepackage{ifthen}


begin{filecontents*}{grade.csv}
option, descriptionb, description, pricel, pricer
1, {a is b, which}, f, 200, 300
0, b, g, 30, 244
1, c, {h, fdsf, dsfd}, 45, 222
1, d, j, 0, 455
FALSE, FALSE, k, 0, 344
end{filecontents*}


begin{document}

Example 2:
 csvreader[tabular= >{stepcounter{Rownumb}theRownumb}r >{everypar{hangindent0.7cm}}p{3cm} b{1.5cm}, filter ifthen=equal{csvcoli}{1}]{grade.csv}{2=dbo, 3=deo,4=pricel, 5=pricer}{ & textbf{dbo} deo & mce     mce    && $,  hfill ifthenelse{equal{pricel}{0}}{}{pricel,}pricer  mce}


Example 3:
 csvreader[tabular= >{stepcounter{Rownumbe}theRownumbe}r >{everypar{hangindent0.7cm}}p{3cm} b{1.5cm}, filter ifthen=NOTequal{opt}{FALSE}]{grade.csv}{1=opt, 2=dbo, 3=deo,4=pricel, 5=pricer}{ & textbf{dbo} deo & mce     mce    && $,  hfill ifthenelse{equal{pricel}{0}}{}{pricel,}pricer  mce}


end{document}

In my real example, I have the CSV file created with an Excel file ({each cell’s text }). Wherever there are commas (I found that out), I get these String/text symbols: ” (highlighted in yellow)
problem highlighted in yellow

Unfortunately, I don’t get it with my sample code, I can add commas and don’t get it. Which suggest that Excel must save it differently. Here is the example file:
CSV example

Is there a code which I can use inside Excel to write commas? (I can underline and textbf{ to take effect in code) Using ; isn’t really an option.

One Answer

Thank you @Schrödinger's cat and @ barbara beeton.

I have found a solution: If you use newcommand{comma}{, } in your preamble and then substitute all commas in Excel with comma it works beautifully.

Answered by Chris Peh on May 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP