% This file is embedded in datatool-user.pdf version 3.4.4 2026-07-31
% Example 113 Automatically Reformatting Data While Loading a CSV file
% Label: "ex:auto-reformat-csv"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{scontents}% to write test file with TABs preserved
\begin{scontents}[write-out={profits.csv},overwrite]
Year,Profit,Units
1999,"-\$4,673",12467
2000,"\$2,525.49",8965
2001,"\$1,673.52",14750
2002,"-\$1,320.01",14572
2003,"\$5,694.83",13312
2004,"\$-451.67",9764
2005,"\$6,785.20",11235
\end{scontents}

% This document additionally required datatool-english and datatool-regions to be installed
 \usepackage[locales={en-US}]{datatool}
\DTLsetup{store-datum,default-name=profits}
\DTLread[
 format=csv,
 csv-content=tex,
 only-reformat-columns={2,3},
]{profits.csv}
\DTLsetLocaleOptions{US}{currency-symbol-sep=thin-space} 
\begin{document}
\DTLaction{display} 
\end{document}
