Python reads excle files need to be installed XLRD
1 #python reads excle files need to be installed XLRD2 Importxlrd3 #opens a excle file4File=xlrd.open_workbook ('E:\learning\list.xlsx')5 #open one of the forms in the Excle file6A=file.sheets () [1]7 #table = data.sheet_by_index (0) #通过索引顺序获取8 #table = data.sheet_by_name (U ' Sheet1 ') #通过名称获取9 #print the specified line a.row_values (line number)Ten Print(a.row_values (0)) One #print the specified column A Print(A.col_values (1)) - #get the number of rows and columns -Nrows=a.nrows the Print(nrows) -ncols=A.ncols - Print(Ncols) - + #Looping row Data - forIinchRange (nrows): + Print(A.row_values (i)) A at - #Cell Cell -cell_a1=A.cell (0,0). Value - Print(CELL_A1) - -cell_a01=a.row (0) [0].value in Print(CELL_A1) -Cell_a02=a.col (0) [1].value to Print(CELL_A02)
Python read excle table _xlrd module