Closed infokiller closed 4 years ago
Hi there good morning,
Thank you for considering using pylightxl and submitting a feature improvement. This should be any easy addin. I can cook this up later today and let you know when it is done
i started working on this and realized i might not have all the information i need from your request. Can you add a bit more clarification?
would you like the writecsv
return a in memory string? ex: "THIS,THAT\nONE,TWO\n"
I think the most flexible and backwards compatible way would be to have it write to a file object, which can be either a real opened file or something like io.StringIO
.
So you would change the second parameter of writecsv
to accept one of str
, pathlib.Path
, or file-like. The latter is what csv.writer accepts.
take a look at the latest commit on master branch. I wrote some tests against it as well so it should work 👍
Thanks, that works!
AFAIK, doing an in-memory conversion from xlsx to csv is cumbersome right now, because
writecsv
doesn't allow writing to any stream likeio.StringIO