How to compress Excel buffer into ZIP buffer

0 votes

I'm attempting to compress an Excel BytesIO stream into a ZIP BytesIO stream, but using the write command results in ValueError: stat: embedded null character in the path being called (). Both pyzipper and pyminizip that I tried didn't perform well.

def __compress_excel__(self, excel_buffer):
    zip_buffer = BytesIO()
    password = b'password'
    zip_buffer = pyzipper.AESZipFile(zip_stream,  mode='w')
    zip_buffer.setpassword(password)
    zip_buffer.write(excel_buffer.getvalue())
    return zip_buffer.getvalue()

Can someone please help me with this?

Sep 22 in Others by Kithuzzz
• 20,660 points
74 views

1 answer to this question.

0 votes

The problem is that something you're using is expected to be passed a file path, not an open file. You should be able to compress the excel_buffer using the zlib module in the standard library. See this answer for an example. 

answered Sep 23 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer

Excel: How to merge two columns into one (from different sheets or separated columns)

This equation is completely adjustable. Your two ...READ MORE

answered Oct 7 in Others by narikkadan
• 37,660 points
68 views
0 votes
1 answer

How to paste an Excel chart into PowerPoint placeholder using Python?

Very near indeed! Copy and Paste are ...READ MORE

answered Oct 7 in Others by narikkadan
• 37,660 points
231 views
0 votes
1 answer

How to Import Excel Worksheet into Microsoft Project?

Solution: Wizard's preliminary settings: New map As a new project Tasks, ...READ MORE

answered Oct 14 in Others by narikkadan
• 37,660 points
44 views
0 votes
1 answer

How to insert info into online excel spreadsheet with python selenium

I recently discovered one of my options, ...READ MORE

answered Oct 24 in Others by narikkadan
• 37,660 points
62 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 3,122 views
0 votes
1 answer
0 votes
1 answer

How to get the JasperReports into Excel format with proper alignment

Remove at least one parameter: exporter.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,Boolean.TRUE) Note that JRXlsExportParameter is deprecated the correct ...READ MORE

answered Sep 21 in Others by narikkadan
• 37,660 points
181 views
0 votes
1 answer

Excel, How to split cells by comma delimiter into new cells

The Excel manual method: choose Text to Column ...READ MORE

answered Oct 3 in Others by narikkadan
• 37,660 points
64 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP