# -*- coding:utf-8 -*- import xlrd workbook = xlrd.open_workbook(unicode("C:\Users\user\Desktop\Таблица.xlsx", "utf-8")) worksheet= workbook.sheet_by_name(unicode("Лист1", "utf-8")) total_rows= worksheet.nrows total_cols= worksheet.ncols table = list() record =list() for x in range(total_rows): for y in range(total_cols): record.append(worksheet.cell(x,y).value) table.append(record) record=[] x +=1 print(table) 
  • indicate in the question the essence of the problem. If there is an error - give the full error traceback ... - MaxU

1 answer 1

If you want to get a list of lists containing cell values ​​(internal lists) for each row (external list), you can use Pandas (by default, Pandas uses xlrd to read Excel files):

 import pandas as pd df = pd.read_excel(u"C:/Users/user/Desktop/Таблица.xlsx") table = df.values.tolist() 

Example:

 In [84]: df = pd.read_excel(u'd:/temp/test.xlsx') In [85]: df Out[85]: abc 0 aaa 1.1 100 1 bbb 2.2 200 2 ccc 3.3 300 In [86]: df.dtypes Out[86]: a object b float64 c int64 dtype: object In [87]: df.values.tolist() Out[87]: [['aaa', 1.1, 100], ['bbb', 2.2, 200], ['ccc', 3.3, 300]]