mercredi 3 août 2016

python add items to list and stop when you get an empty value

I have an excel document that I am reading, it has an unknown number of lines, I want to add each line and the three values of columns A B and C into a list and then stop once I reach none. I then want to run an action on each item in the list.

I am terrible with if/for loops if someone could help.

Below is loading argument 3 as the workbook and sheet. I need to start at line A61 and add A61,B61,C61 to a list and keep going until A whatever is = to none.

if len(sys.argv) > 3: wb = openpyxl.load_workbook(sys.argv[3]) type(wb) sheet = wb.get_sheet_by_name('Sheet1') c = sheet['A61']

Aucun commentaire:

Enregistrer un commentaire