csvkit to import CSVs in a uniform format
I’ve really been enjoying the power of csvkit
to reliably munge CSVs into a uniform format - regardless the format from the provider (not only the order of columns, but also more complex transformations like whether debits are positive or negative):
SQLALCHEMY_SILENCE_UBER_WARNING=1 csvsql --no-inference \
--query 'SELECT COALESCE("Transaction Date",""),"=-"||COALESCE("Amount (USD)",""),COALESCE("Category",""),COALESCE("Description","")||"||"||COALESCE("Merchant","")||"||"||COALESCE("Type",""),"Apple Card" \
FROM stdin' \
| csvformat -T | tail -n+2 | sort