I am starting with Python and I am running into difficulty. I am trying to pass the result of a loop in Python to a specific sheet and column of an Excel file.
I am doing it with XlsWriter but it doesn't work. For example, if you want to pass the result of this loop of random numbers, what is wrong with this code?
Example:
import xlsxwriter
workbook = xlsxwriter.Workbook(r'C:\Users\Me\Downloads\ej.xlsx')
worksheet = workbook.add_worksheet("Hoja1")
worksheet.write('A1', 'NUMEROS')
from random import seed
from random import random
seed(1)
row =0
for _ in range(5):
value = random()
worksheet.write(row, 1, value)
row += 1
print(value)
Sorry for my English, I am not a native speaker.
Thanks a lot.