I am trying to create an export to excel functionality in my django view as follows:
def export_myreport(request, sd, ed):
from xlsxwriter.workbook impor
Excel, and thus XlsxWriter, doesn't support timezones in dates/times.
So you will need to remove or adjust the timezone from the datetime before passing it to XlsxWriter.
Something like this from the pytz docs:
dt = datetime(2005, 3, 1, 14, 13, 21, tzinfo=utc)
naive = dt.replace(tzinfo=None)
Probably this would be better handled in Django though rather than adjusting all datetime data prior to passing it to XlsxWriter. Maybe someone else can add a suggestion on that.