def exportar_ods(request):
    response = HttpResponse(
        content_type="application/vnd.oasis.opendocument.spreadsheet .ods")
    response[
        "Content-Disposition"] = 'attachment; filename="dados-municipios-cadastrados-snc.ods"'

    workbook = xlwt.Workbook()
    planilha = workbook.add_sheet("SNC")
    preenche_planilha(planilha)

    workbook.save(response)

    return response
def exportar_ods(request):
    response = HttpResponse(
        content_type="application/vnd.oasis.opendocument.spreadsheet .ods"
    )
    response[
        "Content-Disposition"
    ] = 'attachment; filename="dados-municipios-cadastrados-snc.ods"'

    workbook = xlwt.Workbook()
    planilha = workbook.add_sheet("SNC")
    preenche_planilha(planilha)

    workbook.save(response)

    return response
def exportar_xls(request):
    output = BytesIO()

    workbook = xlsxwriter.Workbook(output)
    planilha = workbook.add_worksheet("SNC")
    ultima_linha = preenche_planilha(planilha)

    planilha.autofilter(0, 0, ultima_linha, 16)
    workbook.close()
    output.seek(0)

    response = HttpResponse(output.read(),
                            content_type="application/vnd.ms-excel")
    response[
        "Content-Disposition"] = 'attachment; filename="dados-municipios-cadastrados-snc.xls"'

    return response
def exportar_xls(request):

    output = BytesIO()

    workbook = xlsxwriter.Workbook(output)
    planilha = workbook.add_worksheet("SNC")
    ultima_linha = preenche_planilha(planilha)

    planilha.autofilter(0, 0, ultima_linha, 16)
    workbook.close()
    output.seek(0)

    response = HttpResponse(output.read(), content_type="application/vnd.ms-excel")
    response[
        "Content-Disposition"
    ] = 'attachment; filename="dados-municipios-cadastrados-snc.xls"'

    return response