-2

Problem Statement: So far I can open the .xlsx with xlrd. Now I need to print all the cell.values except the first row, help pls

Current Code:

{import xlrd


book = xlrd.open_workbook("test.xls")
sheet = book.sheet_by_index(0)}

Question: How can I print all the cell values except from the excel sheet except for the first row?

Adil B
  • 14,635
  • 11
  • 60
  • 78
Giacomo F
  • 7
  • 1

1 Answers1

0
import os
import xlrd

workbook = open_workbook(os.path.join(filepath + filename),
                         on_demand=True)
yoursheet = workbook.sheet_by_index(0)
allrows = []
for index in range(1, yoursheet.nrows):
    thisrow = yoursheet.row_values(index)
    allrows.append(thisrow)

for rw in allrows: 
    print rw

workbook is the .xls file at /filepath/filename -> worksheet(0) is the first worksheet -> each row values are stored in the list allrows starting with row(1) beccause of the for loop starts at 1 : for index in range(1