ExcelWriter does not support BytesIO input #7074

Closed
filmor opened this Issue May 8, 2014 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

filmor commented May 8, 2014

At least XlsxWriter supports writing to buffers but the ExcelWriter constructors try to read the extension of the supplied path, so it fails when you initialise it as ExcelWriter(buf, engine="xlsxwriter").

Currently you can hack that into pandas using

b = BytesIO()
w = ExcelWriter("data.xlsx", engine="xlsxwriter")
w.book = xlsxwriter.Workbook(b)
df.to_excel(w)
w.save()
b.getvalue()

but it would of course be nice if this just worked out-of-the-box. I'll try to build a PR for that.

Contributor

jreback commented May 8, 2014

this was attempted in #5992

so you can maybe resurrect some of that (that needed tests)

jreback added this to the 0.15.0 milestone May 8, 2014

jreback changed the title from ExcelWriter does not support `BytesIO` input to ExcelWriter does not support BytesIO input May 8, 2014

@jreback jreback modified the milestone: 0.16.0, Next Major Release Mar 6, 2015

@jreback jreback modified the milestone: 0.17.0, Next Major Release Jun 18, 2015

@bashtage bashtage pushed a commit to bashtage/pandas that referenced this issue Jun 20, 2015

Kevin Sheppard + Kevin Sheppard ENH: Enable ExcelWriter to construct in-memory sheets
Add support for StringIO/BytesIO to ExcelWriter
Add vbench support for writing excel files
Add support for serializing lists/dicts to strings
Fix bug when reading blank excel sheets
Added xlwt to Python 3.4 builds

closes #8188
closes #7074
closes #6403
closes #7171
closes #6947
9220309

jreback closed this in #10376 Jun 20, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment