LibreCat / Catmandu-XLS

an XLS exporter
https://metacpan.org/release/Catmandu-XLS
0 stars 2 forks source link

Adding as_colmns option #2

Closed phochste closed 9 years ago

phochste commented 9 years ago

I need to process XLS files that have such bad header names (containing new lines, slashes, spaces, parentheses, etc) that it is impossible to manipulate with Catmandu fixes. The as_columns option translates all the column names into coordinates: A,B,C,D, etc.

nichtich commented 9 years ago

The corresponding option in Catmandu::Exporter::CSV and Catmandu::Exporter::XLS is header, in Catmandu::Exporter::Table it is named columns. We should stick to one common name for tabular-data importers and exporters.

jorol commented 9 years ago

In the synopsis of Catmandu::Exporter::Table you use header

catmandu convert CSV to Table --fields id,name --header ID,Name < sample.csv

in the configuration section columns

Table output can be controlled with the options fields, columns, widths, and condense

Which one should we use? I would use header

phochste commented 9 years ago

"Header" has also another meaning in Catmandu::Exporter::XLS(X): it is a boolean there to switch on/off headers. Same is true in Catmandu::Exporter::CSV. I don't know if this double meaning is valid in Catmandu::Exporter::Table

jorol commented 9 years ago

With the header option of Catmandu::Importer::CSV you could do something like this:

$ printf "a,b,c\n1,2,3" | catmandu convert CSV --header 1 --fields x,y,z to YAML
---
x: '1'
y: '2'
z: '3'
...

Would that be a solution for the XLS(X) importer?

nichtich commented 9 years ago

In fact Catmandu::Exporter::Table uses columns but the documentation says header. fields is used to specify field names and columns/header/as_header to specify the column names. How about:

So for Catmandu::Importer::XLS the option should be named columns instead of as_columns. And Catmandu::Exporter::XLS should also get a columns option.

jorol commented 9 years ago

See pr #3. I will also work on the exporter modules.

jorol commented 9 years ago

And Catmandu::Exporter::XLS should also get a columns option.

Do we really need this option for the XLS(X) exporters, as software like Excel, Calc, ... already provides column coordinates by default?

nichtich commented 9 years ago

Option columns is meant to controll column names in the header, for instance "Herausgeber" for field "publisher". This is useful for all tabular exporters.