[Csv] Access Products sample

Kevin Altis altis at semi-retired.com
Thu Jan 30 07:33:49 CET 2003


I created a db and table in Access (products.mdb) using one of the built-in
samples. I created two rows, one that is mostly empty. I used the default
CSV export to create(Products.csv) and also output the table as an Excel
97/2000 XLS file (Products.xls). Finally, I had Excel export as CSV
(ProductsExcel.csv). They are all contained in the attached zip.

The currency column in the table is actually written out with formatting
($5.66 instead of just 5.66). Note that when Excel exports this column it
has a trailing space for some reason (,$5.66 ,).

While exporting it reminded me that unless a column in the data set contains
an embedded newline or carriage return it shouldn't matter whether the file
is opened in binary mode for reading.

Without a schema we don't know what each column is supposed to contain, so
that is outside the domain of the csv import parser and export writer.

The values exported by both Access and Excel are designed to prevent
information loss within the constraints of the CSV format, thus a field with
no value (what I think of as None in Python) is empty in the CSV

We should we be able to import and then export using a given dialect, such
that there would be no differences between the original csv and the exported
one? Actually, using the Access default of quoting strings it isn't possible
to do that because it implies having a schema to know that a given column is
a string. With the Excel csv format it is possible because a column that
doesn't contain a comma won't be quoted.

Just thinking out loud.

ka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: products.zip
Type: application/x-zip-compressed
Size: 17035 bytes
Desc: not available
Url : http://mail.python.org/pipermail/csv/attachments/20030129/e29424d8/attachment.bin 


More information about the Csv mailing list