jeudi 6 février 2020

How to read and print random rows from Excel file in Python?

I'm trying to create a script that will output random rows from an Excel file. Essentially, this would be like flashcards for studying. I want random rows of data to output one at a time. What I have so far is below; I know I'm off and need some help.

import xlrd
import random
loc = ("FILE PATH")

wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)

sheet.cell_value(0,0)

for i in range(sheet)
    print(random.sheet.row_values)



Aucun commentaire:

Enregistrer un commentaire