Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExcelWriter does not support BytesIO input #7074

Closed
filmor opened this issue May 8, 2014 · 1 comment · Fixed by #10376
Closed

ExcelWriter does not support BytesIO input #7074

filmor opened this issue May 8, 2014 · 1 comment · Fixed by #10376
Labels
Enhancement IO Excel read_excel, to_excel
Milestone

Comments

@filmor
Copy link
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.

@jreback
Copy link
Contributor

jreback commented May 8, 2014

this was attempted in #5992

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

@jreback jreback added this to the 0.15.0 milestone May 8, 2014
@jreback jreback changed the title ExcelWriter does not support BytesIO input ExcelWriter does not support BytesIO input May 8, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jreback jreback modified the milestones: 0.17.0, Next Major Release Jun 18, 2015
bashtage pushed a commit to bashtage/pandas that referenced this issue Jun 20, 2015
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 pandas-dev#8188
closes pandas-dev#7074
closes pandas-dev#6403
closes pandas-dev#7171
closes pandas-dev#6947
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants