Python Module Learning xlrd reading Excel Xlrd.open_workbook (filepath,formatting_info=true) Error: Notimplementederror:formatting_info =true not yet implemented

Source: Internet
Author: User


Problem: Xlrd add formatting_info=true error when reading Excel


Before we used to read the XLS file is the use of the XLRD library, but this library can only operate. xls format, for later. xlsx version support is not too good:
For example: When you use XLRD to load xlsx files, you add the
Xlrd.open_workbook (FilePath, Formatting_info=true)
Formatting_info=true is used to save excel in its original format.
You will get this error prompt immediately:








Traceback (most recent call last):
  File "xxxxxxxx\test_read_excel_color.py", line 7, in <module>
    xlrd.open_workbook(r'./xxxxx.xlsx',formatting_info=True)
  File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 422, in open_workbook
    ragged_rows=ragged_rows,
  File "C:\Python27\lib\site-packages\xlrd\xlsx.py", line 751, in open_workbook_2007_xml
    raise NotImplementedError("formatting_info=True not yet implemented")
NotImplementedError: formatting_info=True not yet implemented


Formatting_info's explanation in the official website is:

> formatting_info –


The default is False, which saves memory. In this case, “Blank” cells, which are those with their own formatting information but no data, are treated as empty by ignoring the file’s BLANK and MULBLANK records. This cuts off any bottom or right “margin” of rows of empty or blank cells. Only cell_value() and cell_type() are available.

This option is used with memory saving. In this case, empty cells, which have formatting information but no data, will be treated as empty. This will crop out any bottom, right "edge" empty table. Only Cell_value () and Cell_type are valid.
In fact, when the option is closed, the following problem occurs when the program needs to load the color code in the cell.








Traceback (most recent call last):
  File "xxxxx\test_read_execel_color1.py", line 10, in <module>
    xf_idx  = xws1.cell_xf_index(0,0)
  File "C:\Python27\lib\site-packages\xlrd\sheet.py", line 420, in cell_xf_index
    self.req_fmt_info()
  File "C:\Python27\lib\site-packages\xlrd\sheet.py", line 1664, in req_fmt_info
    raise XLRDError("Feature requires open_workbook(..., formatting_info=True)")
XLRDError: Feature requires open_workbook(..., formatting_info=True)


I don't know if there are any other problems in there. With this option turned off, some xlrd code would not be able to write like this.


Solutions
    1. Save excel in. xlsx format as. xls format; PS: Modifying the. xlsx file suffix directly to. xls is not feasible. 
    2. Use the OPENPYXL library to read the XLSX configuration table.


Python module Learning xlrd reading Excel Xlrd.open_workbook (filepath,formatting_info=true) Error: Notimplementederror:formatting_ Info=true not yet implemented


Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

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.