Thanks guys it took me a while and a lot of research, finally get it to
work.
my view.py
import pandas as pd
from django.http import HttpResponse
try:
from io import BytesIO as IO # for modern python
except ImportError:
from StringIO import StringIO as IO # for legacy python
def download
hi,
I don´t have this github, so let me try to show you what I do.
Sorry if I´m not applying best practices, but this is working on my side; I
run this manually from cmd in Windows 10 (no django on this).
Content of my requirements.txt:
et-xmlfile==1.0.1
jdcal==1.3
openpyxl==2.5.1
pyodbc==4.0.22
The same way you pass parameters to any view.
On Mon, Apr 16, 2018 at 8:50 PM, sum abiut wrote:
> Thanks Larry,
> How to i pass my query parameter to the xlsxwriter.
>
> Cheers
>
>
>
> On Tue, Apr 17, 2018 at 1:42 AM, Larry Martell
> wrote:
>>
>> I use xlsxwriter and I do it like this:
>>
>>
I was just giving you an example of how I do it. You do not need to
use xlsxwriter - you can use anything you want to generate your xls
files. The key to allowing the user to download it is returning a
HttpResponse with content_type='application/ms-excel'
On Mon, Apr 16, 2018 at 6:26 PM, sum abiut
Thanks Larry,
How to i pass my query parameter to the xlsxwriter.
Cheers
On Tue, Apr 17, 2018 at 1:42 AM, Larry Martell
wrote:
> I use xlsxwriter and I do it like this:
>
> output = io.BytesIO()
> workbook = xlsxwriter.Workbook(output, {'in_memory': True})
> # write fi
Thanks Larry,
I haven't actually try xlsxwriter before so i find some difficulties
understanding your code. Do you mind explaining the code, i will definitely
have a read on the documentation.
cheers
On Tue, Apr 17, 2018 at 1:42 AM, Larry Martell
wrote:
> I use xlsxwriter and I do it like this
I use xlsxwriter and I do it like this:
output = io.BytesIO()
workbook = xlsxwriter.Workbook(output, {'in_memory': True})
# write file
output.seek(0)
response = HttpResponse(output.read(),
content_type='application/ms-excel')
response['Content-Dispos
my code actually worked. I thought it was going to save the excel file to
'C:\excel' folder so i was looking for the file in the folder but i
couldn't find the excel file. The excel file was actually exported to my
django project folder instead.
How to i allow the end user to be able to download t
I wrote a function to export sql query to an excel file, but some how the
excel file wasn't created when the function was call. appreciate any
assistances
here is my view.py
def download_excel(request):
if "selectdate" in request.POST:
if "selectaccount" in request.POST:
s
9 matches
Mail list logo