找了好久的perl在window上读excel的脚本
清单 1:安装 Excel 模块的 PPM 命令
ppm> install OLE::Storage_Lite
ppm> install Spreadsheet::ParseExcel
ppm> install Spreadsheet::WriteExcel
总是报一下错误!!
Can't locate Spreadsheet/Read.pm in @INC (you may need to install the Spreadsheet::Read module) (@INC contains: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .) at D:\201505\20150514\testr.pl line 5.
BEGIN failed--compilation aborted at D:\201505\20150514\testr.pl line 5.
后用以下程序测试通过:
#!/usr/bin/perl -w
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3; # die on errors...
# get already active Excel application or open new
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit');
# open Excel file
my $Book = $Excel->Workbooks->Open("D:/201505/20150514/Book1.xlsx");
# You can dynamically obtain the number of worksheets, rows, and columns
# through the Excel OLE interface. Excel's Visual Basic Editor has more
# information on the Excel OLE interface. Here we just use the first
# worksheet, rows 1 through 4 and columns 1 through 3.
# select worksheet number 1 (you can also select a worksheet by name)
my $Sheet = $Book->Worksheets(1);
foreach my $row (1..4)
{
foreach my $col (1..3)
{
# skip empty cells
next unless defined $Sheet->Cells($row,$col)->{'Value'};
# print out the contents of a cell
printf "At ($row, $col) the value is %s and the formula is %s\n",
$Sheet->Cells($row,$col)->{'Value'},
$Sheet->Cells($row,$col)->{'Formula'};
}
}
# clean up after ourselves
$Book->Close;
别人引用的:如果您正在使用 Windows 机器,请坚持使用 Win32::OLE 模块,除非您的机器上根本没有 Excel。虽然 Spreadsheet::WriteExcel 和 Spreadsheet::ParseExcel 模块的功能正不断完善,但 Win32::OLE 是目前获得 Excel 数据的最简便方式。
在 UNIX,特别是 Linux 上,请使用 Spreadsheet::WriteExcel 和 Spreadsheet::ParseExcel 模块对 Excel 数据进行编程访问。
找了好久的perl在window上读excel的脚本相关推荐
- OSChina 周五乱弹 ——好久不见,你穿上衣服我差点认不出来
2019独角兽企业重金招聘Python工程师标准>>> 恰好 - 霍尊 @上古遗露 : 感觉一个礼拜又要过去了..现在对于时间的感觉是这样的:卧槽,明天又周一了:卧槽,又到周末了:卧 ...
- 将Vue项目methods中的方法暴露在window上
这座城市风很大,孤独的人总是晚回家. 我是一个H5,咱们在写APP的时候,也就是APP内部嵌套咱们H5代码的时候,肯定会遇到交互问题,如果使用普通html js css的话应该没有什么太大的问题,因为 ...
- UnityWebRequest 在Mac上与Window上的不同
有一次开发发现,UnityWebRequest有一个路径在window上运行正常,在mac上运行就会报错,找不到路径 UnityWebRequest request = UnityWebRequest ...
- jenkins编译java_在Window上使用Jenkins自动发布Java工件
jenkins编译java 这篇文章将展示如何使用Jenkins Continuous Integration自动执行Java Web应用程序(使用MYSQL DB和基于Hibernate ORM在基 ...
- linux系统读取excel文件是否存在,小弟我用poi读excel,在window下没有有关问题,但把程序放到linux上时,读取客户端的excel文件报错,不...
我用poi读excel,在window下没有问题,但把程序放到linux上时,读取客户端的excel文件报错,不知道如何解决 我用poi读excel,在window下没有问题,但把程序放到linux上 ...
- Window上安装kafka
kafka在windows上的安装.运行 - 进阶者ryan-su - CSDN博客 https://blog.csdn.net/u010283894/article/details/77106159 ...
- 如何在TypeScript的`window`上显式设置新属性?
本文翻译自:How do you explicitly set a new property on `window` in TypeScript? I setup global namespaces ...
- linux上的客户端连接window上的服务器
server代码: window上的服务器代码不变,但是需要注意一点:linux上的client连接服务器上的server时服务器的防火墙必须关闭才能连接成功. #define WIN32_LEAN_ ...
- 为什么window上没有php-fpm?
1.cgi.fastcgi.php-cgi.php-fpm是什么? cgi 能让web浏览器和web服务器之间沟通POST数据等. fastcgi 在cgi的基础上增加了管理者,master/work ...
最新文章
- linux gcc编译c文件头文件,使用GCC编译器编译C语言
- 一天搞定CSS: 浮动(float)与inline-block的区别--11
- MemCache内存缓存系统
- Django框架基础知识点
- Hsiaoyang:Google搜索结果页面分析
- i++ 和 ++i 效率的分析以及自定义类型的自增/自减运算符重载实例
- 【直播间】移动互联网产品中如何用好HTML5?
- 二级专业目录计算机(软件)类,一、二级学科专业目录及名称代码表
- 两种实现九九乘法表的vb代码
- 智能指针之atuo_ptr源码剖析
- ubuntu清理cache
- Win10自动更新永久关闭Windows update medic service拒绝访问
- Prometheus(四)——Alertmanager
- 【JAVA】(vip)蓝桥杯试题 基础练习 阶乘计算 BASIC-30 JAVA
- Windows批处理 - 小程序大作用
- 微信小程序实现跑马灯效果(完整代码)
- OF-Link物联网云平台简介
- 建立私有CA实现证书申请颁发
- 学波尔还是学王励勤?-----再谈正手弧圈的重心转移
- 心理健康APP开发解决方案
热门文章
- 《程序员》2012年1期精彩内容:回顾与展望
- 生活中的小技巧-2:洗衣机洗衣服打结缠绕,该如何解决?学上几个实用招数
- 人生不设限:我那好的不像话的生命体验
- 达内python学费22000_交钱了,学了3天Python编程,我想放弃了......
- Jan. 1, 2020 at 7:47 a.m. GMT+8遇到这种时间,转换成中国标准时间
- 潍坊一个月收入多少算正常?
- c语言的积木编程,c语言入门3,自己造积木,掌握它就能随心所欲的完成各种工作了...
- pak文件的打包和解包
- VoxelNet论文翻译
- Havok物理引擎_百度百科