This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shutil import make_archive | |
from wsgiref.util import FileWrapper | |
def download(request, file_name=""): | |
""" | |
A django view to zip files in directory and send it as downloadable response to the browser. | |
Args: | |
@request: Django request object | |
@file_name: Name of the directory to be zipped | |
Returns: | |
A downloadable Http response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xlrd | |
from openpyxl.workbook import Workbook | |
from openpyxl.reader.excel import load_workbook, InvalidFileException | |
def open_xls_as_xlsx(filename): | |
# first open using xlrd | |
book = xlrd.open_workbook(filename) | |
index = 0 | |
nrows, ncols = 0, 0 | |
while nrows * ncols == 0: |