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
• 12,240 points
13 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
• 20,880 points

Related Questions In Others

0 votes
0 answers

how to list the contents of a asset into an event

May 29, 2019 in Others by anonymous
210 views
0 votes
1 answer
0 votes
0 answers

How to compare two excel sheets

How to compare two excel sheets , ...READ MORE

Jul 18, 2021 in Others by Sri
• 3,190 points
188 views
0 votes
1 answer

How to import data from a HTML table on a website to excel?

Hello  To import any HTML file in excel there ...READ MORE

answered Feb 10 in Others by gaurav
• 18,960 points
117 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,016 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
• 20,880 points
26 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 17 hours ago in Others by narikkadan
• 20,880 points
13 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