هذه الشيفرة المستخدمه
def index(request):
wb = openpyxl.load_workbook(os.getcwd() + r'\excel\math.xlsx')
sheet1 = wb['ورقة1']
num1 = request.POST.get('num1')
num2 = request.POST.get('num2')
# save data in excel
sheet1.cell(column=1, row=2, value=num1)
sheet1.cell(column=2, row=2, value=num2)
wb.save(f'{os.getcwd()}/excel/math.xlsx')
wb.close()
# Reading from Excel and displaying it in the browser
df = pd.read_excel('.\excel\math.xlsx', sheet_name='ورقة1', usecols='A:L')
number1 = df.loc[0]['number 1']
number2 = df.loc[0]['number 2']
sol = df.loc[0]['sol']
context = {'num1': number1,
'num2': number2,
'sol': sol}
return render(request, 'index.html', context)
هذا ملف excel
math.xlsx