Hello everyone.
I'm new to python. I have already tried to make some smal programs as excercise and that works fine for me but now i wanted to make something useful for me.
I have different excel files (list with, names, forname, adress, phone number...). Each excel file has its own list.
Now i want to make a program that can:
This is what i have for now:
I'm new to python. I have already tried to make some smal programs as excercise and that works fine for me but now i wanted to make something useful for me.
I have different excel files (list with, names, forname, adress, phone number...). Each excel file has its own list.
Now i want to make a program that can:
- make one fictive person out of the different excel files (i think mine works!)
- write this to a new excel file
- Asking the user to give how many fictive persons he wants to make and write them all to one excel file.
This is what i have for now:
import xlrd
import random
import xlsxwriter
#==> This I did for every workbook.
workbook = xlrd.open_workbook("achternamen.xlsx")
worksheet = workbook.sheet_by_index(0)
total_rows = worksheet.nrows
total_cols = worksheet.ncols
tableAchternamen = list()
recordAchternamen = list()
for x in range(total_rows):
for y in range(total_cols):
recordAchternamen.append(worksheet.cell(x,y).value)
tableAchternamen.append(recordAchternamen)
recordAchternamen = []
x +=1
#==> This give me a result printed on Python
SlachtofferAchternaam = print(random.choice(tableAchternamen))
SlachtofferVoornamen = print(random.choice(tableVoornamen))
SlachtofferTelefoonnummer = print(random.choice(tableTelefoonnummers))
SlachtofferAdressen = print(random.choice(tableAdressen))
resultaat = (
['Achternaam', SlachtofferAchternaam],
['Voornaam', SlachtofferVoornamen],
['Telefoonnummer', SlachtofferTelefoonnummer],
['Adres',SlachtofferAdressen],
)
#Start van de cellen die gebruikt worden
row = 0
col = 0
for item, cost in (resultaat):
worksheet.write(row, col, item)
worksheet.write(row, col + 1, cost)
row += 1
workbook.close()Please any help is welcome! ! !
