Python read excle table _xlrd module

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.