Reputation: 49
How can I zip a excel file using python ? I have a excel sheet. I want to change ZIP the excel Sheet Using Python. So that It can have less network usages when I try to download from mine Site. Just Another Requirements.
Thanks in Advance.
Please Help
Upvotes: 0
Views: 8443
Reputation: 1840
Python's built in zipfile library can be used to compress any file. Below code should work for you.
#!/usr/bin/env python3
import zipfile
zip_file = zipfile.ZipFile('file_name.zip', 'w')
zip_file.write('/tmp/hello.txt')
zip_file.close()
Upvotes: 1