Python handles Excel's Xlrd

Source: Internet
Author: User
The module that Python handles Excel with is xlrd. With XLRD, you can easily work with Excel documents, and here are some basic usage

1. Open File

Import xlrd

Data= Xlrd.open_workbook ("C:\\skills.xls")

Get a worksheet

Table = data.sheet_by_name (U ' skills ') #也可以

Table = Data.sheet_by_index (0)

Row, the fetch of the column

Table.row_values (i)

Table.col_values (i)

Number of rows, number of columns, etc.

nrows = Table.nrows

Ncols = Table.ncols

Cell data

CELL_A1 = Table.cell (0, 0). Value

CELL_C4 = Table.cell (2, 3). Value

#简单写单元格

Table.put_cell (Row, col, CType, value, XF)

row = Col = 0

CType = 1 # 0 empty, 1 string, 2 number, 3 date, 4 bool, 5 error

Value = ' This is cell value '

XF = 0


For more functions, please refer to the official documentation

https://secure.simplistix.co.uk/svn/xlrd/trunk/xlrd/doc/xlrd.html?p=4966

  • 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.