[Kmymoney-devel] Is the new CSV importer working correctly?

Allan agander93 at gmail.com
Tue Nov 29 16:29:14 UTC 2011


On 29/11/11 15:27, Jack wrote:
> On 2011.11.29 10:03, David Houlden wrote:
>> Hi,
>> I downloaded a csv bank statement from my bank today and ran it
>> through the
>> new CSV importer. I found one problem which is maybe a little unusual
>> and is
>> down to the way my bank formatted the file. I have attached an editted
>> version
>> of the file which contains the first record showing the headers and
>> the data
>> record which caused a problem.
>>
>> The 5th field on the record in question is the Transaction Description
>> and it
>> contains a comma. That part of the field is however contained within
>> double
>> quote characters. The unusual feature is that only part of the field is
>> contained in double quotes. The back end (which doesn't contain a
>> comma) is
>> not. Importing this file confuses the CSV importer and results in the
>> whole of
>> the record from the Transaction Description onwards being put into the
>> Transaction Description field even though there are other fields
>> delimited by
>> comma.
>>
>> I appreciate that this may be unusual data but I would expect that
>> each record
>> should be broken into fields using the field delimiter but ignoring
>> any field
>> delimiters which are contained within double quotes (the text delimiter).
>> Indeed, this file imports as I would expect into LibreOffice Calc.
>>
>> If required I will raise a bug report for this.
>
> Personally, I would say it is just lucky that LO imports this correctly.
> In a delimited file, you should have only one value between a pair of
> delimiters, and if it is a text field containing the delimiter, it (the
> entire value) needs to be quoted. Quoting only part of a field doesn't
> make any sense. Unfortunately, it's not clear to me that the little that
> passes for a standard here sufficiently addresses this issue. (See
> http://en.wikipedia.org/wiki/Comma-separated_values). I suspect the
> issue for the author of the plugin will be how flexible are the routines
> used that actually parse the file.
>
> Jack

Actually, one of my test files does have a field separator within quotes 
- coincidentally, provided by Jack - but in that case the whole of the 
field is quoted, unlike in the current example.

However, we can't be beaten by Calc!

Allan



More information about the KMyMoney-devel mailing list