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, 2022 in Others by Kithuzzz
• 38,000 points
1,183 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.
answered Sep 23, 2022 by narikkadan
• 63,600 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, 2022 in Others by narikkadan
• 63,600 points
880 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, 2022 in Others by narikkadan
• 63,600 points
4,306 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, 2022 in Others by narikkadan
• 63,600 points
1,350 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, 2022 in Others by narikkadan
• 63,600 points
1,310 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 4,464 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, 2022 in Others by narikkadan
• 63,600 points
3,887 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, 2022 in Others by narikkadan
• 63,600 points
920 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