Python Read Excel File

Source: Internet
Author: User

Now most of the data are stored in Excel or directly to the database, as just self-learning python small Bailai said how to read the file or a bit more ignorant, now Python read the Excel file to do some sorting:

#Coding=utf-8#cmd to install the XLRD librarypip Install xlrdImportxlrd#file path, use/not \File_path = R'c:/users/mingli.zhao/desktop/seven days. xlsx'#Chinese transcoding#File_path = File_path.decode (' utf-8 ')#Get Datadata =Xlrd.open_workbook (File_path)#Get SheetTable = Data.sheet_by_name ('Sheet1')#get total number of rowsnrows =table.nrows#get total number of columnsNcols =Table.ncols#gets the value of the first rowTable.row_values (1)#get the numeric value of the first columnTable.col_values (1)#gets the value of the first column cell in the second rowCell_value = Table.cell (1,0). Value

Python Read Excel File

Related Article

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.