An xlsx file in Python that operates in Excel 2000 (using OPENPYXL)

Source: Internet
Author: User
Tags ranges

1 http://download.csdn.net/detail/kernelke/5192910

2 Download File openpyxl-1.6.1.tar.gz

3 Unzip to any path, for example: The path after decompression is C:\openpyxl-1.6.1

4 Installation

Open the Windows window and enter the following:

CD C:\openpyxl-1.6.1

Python setup.py Install

5 Easy to use

Just play it under the shell.
>>> from openpyxl.reader.excel import Load_workbook #包导入
>>> wb = Load_workbook (filename=r ' c:/test.xlsx ') #打开文件
>>> print "Worksheet ranges (s):", Wb.get_named_ranges ()
Worksheet ranges (s): []
>>> print "Worksheet names (s):", Wb.get_sheet_names ()
Worksheet names (s): [' Sheet1 ', ' Sheet2 ', ' Sheet3 ']
>>> sheetnames = Wb.get_sheet_names ()
>>> ws = Wb.get_sheet_by_name (sheetnames[0]) #打开sheet1
>>> for Rx in range (Ws.get_highest_row ()): #对第一个column遍历打印值
Print Ws.cell (row=rx,column=0). Value

An xlsx file in Python that operates in Excel 2000 (using OPENPYXL)

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.