Skip to content

CSV output columns order #257

Description

@Vartkat

Could you implement a way to set the columns order in the CSV output ?

Especially in the lines.
If we ask for a csv file, the lines column contains Json it should be csv.

In a CSV the file should look like
desc,vat,amount,lines,issuer,date,amount_untaxed,currency,invoice_number
with 'lines' replaced by the tags defined in the regex.

For example in my template line regex is :
line: '(\d{6}\s+(?P<Name>.{30,38}\s)\s+(?P<Quant>\d{1,3})\s+(|\w{2})\s+(|\-)(GRATUIT|PROMO|\d{1,4}\.\d{2})\s+\w{2}\s+\d\s+(Nt|(\d{2}\.\d{2}))\s+(|\-)(?P<Unit>\d{1,4}\.\d{2})\s+(|\-)(?P<Tot>\d{1,4}\.\d{2}))

so the CSV should be

desc,vat,amount,Name, Quant,Unit,Tot,issuer,date,amount_untaxed,currency,invoice_number
Only the first row would be complete, other lines (the ones containing the lines rows) would have invoice infos empty.

More, I should be able to tell invoice2data in which order to output the columns.

So to be fully precise, I would like to be able to make my output to be

issuer , invoice_number, date , desc, vat, amount_untaxed, amount, currency,Name, Quant,Unit,Tot
SomeFirm, 123456, 2019-09-22, SomeDescription, 200.00, 1000.00, EUR, Ice cream, 10, 2.31, 23.10
,,,,,,,Donuts, 5.00, 10.00, 50.00
,,,,,,,T5 screw driver, 2.23, 1.00, 2.23


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions