一直认为python3可以很快的实现很多简单的功能,今天要读excel表格数据,想来很简单,网上一搜,用xlrd即可,然后很多人给出了不同的版本,号称xlrd3,实际上官网一看,xlrd0.9.4兼容2和3,因此直接下载即可,网址:https://pypi.python.org/pypi/xlrd

下载后解压,然后通过命令行进入下载的目录,然后C:\python34\python.exe setup.py install即可(我的python安装在C盘,是3.4版)

然后输入以下代码:

#!/usr/bin/env python3

#coding: utf-8

 

import xlrd

wb = xlrd.open_workbook("D:\\send\\mydata.xls")

sh=wb.sheet_by_index(0)#第一个表

cellName = sh.cell(3,2).value

print(cellName)

发现这个错误出现了:Python XLRD Error : formula/tFunc unknown FuncID:186

找了好久,终于国外有个家伙也碰到了,网址如下:http://stackoverflow.com/questions/29971186/python-xlrd-error-formula-tfunc-unknown-funcid186

解决方案的原文回答如下:

For now I just wanted to make sure the xlrd read fine. I hacked my xlrd package so that it loads.

I don't gaurentee the correctness of the output.

Just add the following line in formula.py of your pythonlibs/xlrd package.

Around line 240 where each number is map to a function create a hacked function here. I've inserted 'HACKED' in there. I don't understand exactly what's going on.

-- added the line that starts with 186:

184: ('FACT', 1, 1, 0x02, 1, 'V', 'V'),
186: ('HACKED', 1, 1, 0x02, 1, 'V', 'V'),
189: ('DPRODUCT', 3, 3, 0x02, 3, 'V', 'RRR'),

Here is the discussion by xlrd group. Essentially, this is a complicated problem that can't be resolved. :)

很清楚了,找到formula.py文件186行左右,在文字184和文字189中间加插入一行186: ('HACKED', 1, 1, 0x02, 1, 'V', 'V'),

再运行程序,搞定

python3 读写excel的更多相关文章

  1. Python3.4如何读写Excel

    在python3.x(散仙使用的版本是python3.4)里,我们应该如何操作excel. 首先在python3.4里,我们可以使用新的python类库,来支持3.x之后的读写excel 针对 03版 ...

  2. python 读写 Excel文件

    最近用python处理一个小项目,其中涉及到对excel的读写操作,通过查资料及实践做了一下总结,以便以后用. python读写excel文件要用到两个库:xlrd和xlwt,首先下载安装这两个库. ...

  3. python 全栈开发,Day86(上传文件,上传头像,CBV,python读写Excel,虚拟环境virtualenv)

    一.上传文件 上传一个图片 使用input type="file",来上传一个文件.注意:form表单必须添加属性enctype="multipart/form-data ...

  4. MFC vs2012 Office2013 读写excel文件

    近期在忙一个小项目(和同学一起搞的),在这里客户要求不但读写txt,而且可以读写excel文件,这里本以为很简单,结果...废话少说,过程如下: 笔者环境:win7 64+VS2012+Office2 ...

  5. C# 使用 NPOI 库读写 Excel 文件(转载)

    NPOI 是开源的 POI 项目的.NET版,可以用来读写Excel,Word,PPT文件.在处理Excel文件上,NPOI 可以同时兼 容xls 和 xlsx.官网提供了一份Examples,给出了 ...

  6. 用Python读写Excel文件(转)

    原文:google.com/ncr 虽然天天跟数据打交道,也频繁地使用Excel进行一些简单的数据处理和展示,但长期以来总是小心地避免用Python直接读写Excel文件.通常我都是把数据保存为以TA ...

  7. 使用NPOI读写Excel、Word

    NPOI 是 POI 项目的 .NET 版本.POI是一个开源的Java读写Excel.WORD等微软OLE2组件文档的项目. 使用 NPOI 你就可以在没有安装 Office 或者相应环境的机器上对 ...

  8. 【原创】.NET读写Excel工具Spire.Xls使用(1)入门介绍

    在.NET平台,操作Excel文件是一个非常常用的需求,目前比较常规的方法有以下几种: 1.Office Com组件的方式:这个方式非常累人,微软的东西总是这么的复杂,使用起来可能非常不便,需要安装E ...

  9. 【原创】.NET读写Excel工具Spire.Xls使用(2)Excel文件的控制

                  本博客所有文章分类的总目录:http://www.cnblogs.com/asxinyu/p/4288836.html .NET读写Excel工具Spire.Xls使用文章 ...

随机推荐

  1. HDOJ1020 Encoding

    Problem Description Given a string containing only 'A' - 'Z', we could encode it using the following ...

  2. spring maven pom

    https://spring.io/blog/2009/12/02/obtaining-spring-3-artifacts-with-maven/

  3. 安装 PLSQL笔记

    安装 PLSQL Developer 1. 下载PLSQL Developer 安装文件.安装文件类型是exe,直接安装就可以. 这个时候打开PLSQL Developer ,打开 help –> ...

  4. Google Reader的另一个开源的替代品Go Read

    Google Reader到7月1号退休了,于是出现了一批Google Reader的替代品,比如Google Reader Is Shutting Down; Here Are the Best A ...

  5. UIButton图文上下对齐

    - (void)centerImageAndTitle:(float)spacing { // get the size of the elements here for readability CG ...

  6. XtraReport交叉表自适应行高及最佳列宽

    1.自适应行头的行高,绑定CustomRowHeight事件,代码如下: private Graphics gr = Graphics.FromHwnd(IntPtr.Zero); private v ...

  7. crontab 定时任务 每过多少分钟执行

    被下面的问题纠结了一会 记录一下以备提醒 每过5分钟执行 */ * * * * curl localhost/system/dns/dnns.php?ac=ToDNS 每小时的第五分钟执行 0 * * ...

  8. [RxJS] Error handling operator: catch

    Most of the common RxJS operators are about transformation, combination or filtering, but this lesso ...

  9. Android 仿PhotoShop调色板应用(一)概述

    版权声明:本文为博主原创文章,未经博主允许不得转载. 在前面的系列我已经将Android中颜色渲染的原理及使用做了一个整体上概述. 现在开始根据一个比较复杂的实现进行具体的分析,这就是PhotoSho ...

  10. tcp ip参数详解

    http://www.cnblogs.com/digdeep/p/4869010.html 1. TCP/IP模型 我们一般知道OSI的网络参考模型是分为7层:“应表会传网数物”——应用层,表示层,会 ...