Read rows and columns by Python, by excel

3

My question is if you have any resources so that I can read excel rows and columns. For example: I have experimental data in excel containing header in the first row having some 12 columns of data, then [1:12] it would only be the header, and some 30 lines of numerical data, I wanted to know exactly this, how do you just get the data within that array, and then select each column and form a list?

    
asked by anonymous 10.11.2015 / 18:10

1 answer

2

Yes, there is the xlrd package that reads Excel files for you.

Example:

import xlrd
book = xlrd.open_workbook("meuarquivo.xls")
print "Número de abas: ", book.nsheets
print "Nomes das Planilhas:", book.sheet_names()
sh = book.sheet_by_index(0)
print(sh.name, sh.nrows, sh.ncols)
print("Valor da célula D30 é ", sh.cell_value(rowx=29, colx=3))
for rx in range(sh.nrows):
    print(sh.row(rx))

I've taken the example here .

See also this site .

    
10.11.2015 / 18:14