LibreCat / Catmandu-XLS

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

For XLSX columns get deleted from the importer due to inconsistent behaviour for empty or nil fields #19

Open phochste opened 3 years ago

phochste commented 3 years ago

I guess the XLSX imported should have much better column metadata then the other formats and should know which fields are available in the file.

E.g.

A B C
X X
Y Y Y

Will result in

---
A: X
C: X
...
A: Y
C: Y
...
nics commented 3 years ago

That's what the 'fields' attribute is for if there is no header (fields: "A,B,C"), header: 1 should also do the trick if there is a header column.

phochste commented 3 years ago

brol.xlsx It is a weird behavior:

$ catmandu convert XLSX --header 1 to YAML < brol.xlsx
---
A: X
C: X
...
---
A: Y
B: Y
C: Y
...

whereas

catmandu convert XLSX --header 1 to CSV < brol.xlsx
A,C
X,X
Y,Y

Adding --header=1 doesn't help..one needs to first inspect the xlsx file in a desktop program to discover all the fields and then use it. This is an other behavior than working with CSV files which always seem to know which fields are available in the file.

nics commented 3 years ago

XLSX import works fine, you're expecting the CSV exporter to magically know which columns there are.