Проблема с загрузкой и сохранением файла excel с помощью django

У меня 3 проблемы, не могу разобраться, может есть какие-то связи.

Problem 1.1: file is exported in django documentation and it works, but when I try to rename it, it has some error. I want to be like this with pd.ExcelWriter(newdoc + 'output.xlsx') as writer: in order to every file has a "new" name.

Проблема 1.2: Как добавить путь к месту сохранения?

Problem 2: I get to download file but it is empty, and name of document is Donwload.xlsx. I want to be like this, but this got many errors...

filename = newdoc + '_calculated.xlsx'
response = HttpResponse(output, content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
response['Content-Disposition'] = 'attachment; filename=%s' % filename
return response

Это views.py

def my_view(request):
    if request.method == "POST":
        form = DocumentForm(request.POST, request.FILES)
        if form.is_valid():
            output = io.BytesIO()    
            newdoc = request.FILES['docfile']

            dfs = pd.read_excel(newdoc, sheet_name=None, index_col=[0])

            with pd.ExcelWriter('output.xlsx') as writer: #problem 1 
                for name, df in dfs.items():
                    #pandas code for uploaded excel file
                    out.to_excel(writer, sheet_name=name)
                 
            output.seek(0)

            response = HttpResponse(output, content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
            response['Content-Disposition'] = 'attachment; filename=%s.xlsx' % 'Download' #problem 2
            return response

    else:
        form = DocumentForm()
    return render(request, 'list.html', {'form': form})
Вернуться на верх