dilshod / xlsx2csv

Convert xslx to csv, it is fast, and works for huge xlsx files
MIT License
1.64k stars 302 forks source link

Feature request: read xlsx from STDIN #263

Closed ferdinandyb closed 11 months ago

ferdinandyb commented 11 months ago

I'd love to use something like this in aerc filters, but as far as I can tell, the file to convert must already be on the disk, while I need to be able to pipe it into xlsx2csv.

alephreish commented 11 months ago

It works: in | xlsx2csv /dev/stdin | out (using version 0.8.1)

ferdinandyb commented 11 months ago

I tried it but I get:

Invalid xlsx file: /dev/stdin
Exception ignored in: <function Xlsx2csv.__del__ at 0x7f41ae498b80>
Traceback (most recent call last):
  File "/usr/bin/xlsx2csv", line 213, in __del__
AttributeError: 'Xlsx2csv' object has no attribute 'ziphandle'

both the aerc filter and cat example.xlsx | xlsx2csv /dev/stdin produces the same problem.

alephreish commented 11 months ago

Oh, sorry, apparently I forgot to post an update to my comment: I've been playing with xlsx2csv /dev/stdin < example.xlsx which does work but for cat example.xlsx | xlsx2csv /dev/stdin it return the above exception.

ferdinandyb commented 11 months ago

I've made a python3 only PR. I imagine it could be updated to include python2 as well.