Python Excel row Repeat

Asked 2 years ago, Updated 2 years ago, 133 views

Hello. I'd like to list the number of ranges in Excel For example, if 1.5 is entered, you want to implement it in a format that increases by 0.5 from -1.5 to 1.5.

But I don't know what to do with the row= part of the for door.

import openpyxl
input_1 = 1.5
input_1_r = int(input_1*100)
wb = openpyxl.Workbook()
sheet = wb.active
sheet.cell(row=1, column=1).value="Condition"

for i in range(-input_1_r, input_1_r+1, 5):
    result = ({"condition":i/10000}) 
for j in range(1, 50):
    sheet.cell (row=here is the problem, column=1).value=result.get("conditional")
    print(result)
wb.save('result.xlsx')
wb.close()

excel python loops for row

2022-09-22 18:36

1 Answers

import openpyxl
input_1 = 8.5
input_1_r = int(input_1*10)
wb = openpyxl.Workbook()
sheet = wb.active
sheet.cell(row=1, column=1).value="Condition"

j=2
for i in range(-input_1_r, input_1_r+1, 5):
    result = ({"condition":i/10}) 
    sheet.cell(row=j, column=1).value=result.get("conditional")
    print(result)
    j= j+1
wb.save('result.xlsx')
wb.close()


2022-09-22 18:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.