由于OFFICE 2010的安装包比较庞大,如果仅仅为了在服务器中实现操作EXCEL,完全没有必要安装整个OFFICE,是否可以不装OFFICE也实现与OFFICE文件的互相操作呢?答案是肯定的,在SSIS中只要安装Microsoft Access 2010 数据库引擎可再发行程序包即可实现2010 Microsoft Office System 文件与非 Microsoft Office 应用程序之间传输数据,支持现有的 Microsoft Office 文件(例如 Microsoft Office Access 2010(*.mdb 和 *.accdb)文件和 Microsoft Office Excel 2010(*.xls、*.xlsx 和 *.xlsb)文件)与其他数据源(例如 Microsoft SQL Server)之间传输数据。还支持与现有文本文件建立连接。 此外,还会安装 ODBC 和 OLEDB 驱动程序,供应用程序开发人员在开发与 Office 文件格式连接的应用程序时使用。该安装包下载地址:http://www.microsoft.com/zh-cn/download/details.aspx?id=13255 。

本人负责年初已上线的BI项目,一部分数据是需要自动采集在Sharepoint 2010上的Excel文档库数据,但SSIS服务器并没有安装OFFICE,就是通过此组件实现互操作!对于简单的EXCEL直接通过数据流的方式实现,对于负责的EXCEL则通过脚本实现,具体如下:

1.简单的EXCEL,数据流的实现方式。

2.负责的EXCEL,主要通过脚本实现。

连接Excel并返回所有SHEET脚本示例如下:

string strConn, ls_pjname = string.Empty,strsqlconn=string.Empty;

            strConn = @"Provider=Microsoft.Ace.OleDb.12.0;Data Source="+@as_xlspath+";Extended Properties='Excel 12.0; HDR=NO;IMEX=1'";

            OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
DataTable sheetNames = conn.GetOleDbSchemaTable
(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
conn.Close();

对于表内的数据可以通过SQL语句进行,脚本示例如下:

 /// <summary>
/// 獲取Excel文件中指定Sheet的內容到DataSet,以Sheet名做DataTable名
/// </summary>
/// <param name="FileFullPath">Excel物理路径</param>
/// <param name="no_HDR">第一行不是標題:true;第一行是標題:false;</param>
/// <param name="SheetName">第一行不是標題:true;第一行是標題:false;</param>
/// <returns>DataSet</returns>
public static DataSet GetExcelToDataSet(string FileFullPath, bool no_HDR, string SheetName)
{
try
{
string strConn = GetExcelConnectionString(FileFullPath, no_HDR);
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
DataSet ds = new DataSet();
OleDbDataAdapter odda = new OleDbDataAdapter(string.Format("SELECT * FROM [{0}]", SheetName), conn); //("select * from [Sheet1$]", conn);
odda.Fill(ds, SheetName);
conn.Close();
return ds;
}
catch (Exception ee)
{
throw new Exception(ee.Message);
}
}

通过SSIS可以实现很强大的ETL操作,但前提是根据需求,可能还需要安装一些额外的安装包或组件。

本博客为软件人生原创,欢迎转载,转载请标明出处:http://www.cnblogs.com/nbpowerboy/p/3387268.html 。演绎或用于商业目的,但是必须保留本文的署名软件人生(包含链接)。如您有任何疑问或者授权方面的协商,请给我留言。

http://www.amnxy.com/
http://www.amnxy.com/a/amanidongtai/
http://www.amnxy.com/a/changjianwenti/
http://www.amnxy.com/a/chenggonganli/
http://www.amnxy.com/a/fazhanzhanlue/
http://www.amnxy.com/a/fuwuzhichia/
http://www.amnxy.com/a/fuzhushebei/
http://www.amnxy.com/a/ganxishebei/
http://www.amnxy.com/a/gongsijiagou/
http://www.amnxy.com/a/hezuohuigu/
http://www.amnxy.com/a/hongganjishebei/
http://www.amnxy.com/a/jiamengliucheng/
http://www.amnxy.com/a/jiamengtiaojian/
http://www.amnxy.com/a/kaidianyihuo/
http://www.amnxy.com/a/kaidianzhidao/
http://www.amnxy.com/a/lianxiwomen/
http://www.amnxy.com/a/lirunfenxi/
http://www.amnxy.com/a/mendianfenbu/
http://www.amnxy.com/a/mendianyingxiao/
http://www.amnxy.com/a/mendianzhanshi/
http://www.amnxy.com/a/pinpaijianjie/
http://www.amnxy.com/a/pinpaiyoushi/
http://www.amnxy.com/a/sanxingdiananli/
http://www.amnxy.com/a/shenqingjiameng/
http://www.amnxy.com/a/shuixishebei/
http://www.amnxy.com/a/sixingdiananli/
http://www.amnxy.com/a/touzifangan/
http://www.amnxy.com/a/xiangmuyoushi/
http://www.amnxy.com/a/xingyedongtai/
http://www.amnxy.com/a/xinwenzixun/
http://www.amnxy.com/a/yinglimoshi/
http://www.amnxy.com/a/youhuizhengce/
http://www.amnxy.com/a/zhuanyepeixun/
http://www.amnxy.com/a/ziliaoxiazai/
http://www.amnxy.com/a/amanidongtai/20151109/10.html
http://www.amnxy.com/a/amanidongtai/20151109/11.html
http://www.amnxy.com/a/amanidongtai/20151109/12.html
http://www.amnxy.com/a/amanidongtai/20151109/13.html
http://www.amnxy.com/a/amanidongtai/20151109/14.html
http://www.amnxy.com/a/amanidongtai/20151109/6.html
http://www.amnxy.com/a/amanidongtai/20151109/7.html
http://www.amnxy.com/a/amanidongtai/20151109/8.html
http://www.amnxy.com/a/amanidongtai/20151109/9.html
http://www.amnxy.com/a/amanidongtai/20151115/105.html
http://www.amnxy.com/a/changjianwenti/20151208/161.html
http://www.amnxy.com/a/changjianwenti/20151208/162.html
http://www.amnxy.com/a/changjianwenti/20151208/163.html
http://www.amnxy.com/a/changjianwenti/20151208/164.html
http://www.amnxy.com/a/changjianwenti/20151208/165.html
http://www.amnxy.com/a/changjianwenti/20151208/166.html
http://www.amnxy.com/a/changjianwenti/20151208/167.html
http://www.amnxy.com/a/changjianwenti/20151208/168.html
http://www.amnxy.com/a/changjianwenti/20151208/169.html
http://www.amnxy.com/a/changjianwenti/20151210/199.html
http://www.amnxy.com/a/fuzhushebei/20151116/135.html
http://www.amnxy.com/a/fuzhushebei/20151116/141.html
http://www.amnxy.com/a/fuzhushebei/20151209/176.html
http://www.amnxy.com/a/ganxishebei/20151116/133.html
http://www.amnxy.com/a/ganxishebei/20151116/134.html
http://www.amnxy.com/a/ganxishebei/20151116/136.html
http://www.amnxy.com/a/ganxishebei/20151209/170.html
http://www.amnxy.com/a/ganxishebei/20151209/171.html
http://www.amnxy.com/a/hongganjishebei/20151209/172.html
http://www.amnxy.com/a/hongganjishebei/20151209/173.html
http://www.amnxy.com/a/hongganjishebei/20151209/174.html
http://www.amnxy.com/a/hongganjishebei/20151209/175.html
http://www.amnxy.com/a/kaidianyihuo/20151109/33.html
http://www.amnxy.com/a/kaidianyihuo/20151109/34.html
http://www.amnxy.com/a/kaidianyihuo/20151109/35.html
http://www.amnxy.com/a/kaidianyihuo/20151109/36.html
http://www.amnxy.com/a/kaidianyihuo/20151109/37.html
http://www.amnxy.com/a/kaidianyihuo/20151109/38.html
http://www.amnxy.com/a/kaidianyihuo/20151109/39.html
http://www.amnxy.com/a/kaidianyihuo/20151207/159.html
http://www.amnxy.com/a/kaidianyihuo/20151207/160.html
http://www.amnxy.com/a/kaidianyihuo/20151210/198.html
http://www.amnxy.com/a/kaidianyihuo/20151210/200.html
http://www.amnxy.com/a/lirunfenxi/20151109/21.html
http://www.amnxy.com/a/lirunfenxi/20151109/22.html
http://www.amnxy.com/a/lirunfenxi/20151109/23.html
http://www.amnxy.com/a/lirunfenxi/20151109/24.html
http://www.amnxy.com/a/lirunfenxi/20151109/25.html
http://www.amnxy.com/a/lirunfenxi/20151109/26.html
http://www.amnxy.com/a/lirunfenxi/20151205/150.html
http://www.amnxy.com/a/lirunfenxi/20151205/151.html
http://www.amnxy.com/a/lirunfenxi/20151205/152.html
http://www.amnxy.com/a/lirunfenxi/20151210/196.html
http://www.amnxy.com/a/mendianyingxiao/20151125/142.html
http://www.amnxy.com/a/mendianyingxiao/20151125/143.html
http://www.amnxy.com/a/mendianyingxiao/20151125/144.html
http://www.amnxy.com/a/mendianyingxiao/20151125/145.html
http://www.amnxy.com/a/mendianyingxiao/20151125/146.html
http://www.amnxy.com/a/mendianyingxiao/20151125/147.html
http://www.amnxy.com/a/mendianyingxiao/20151125/148.html
http://www.amnxy.com/a/mendianyingxiao/20151207/157.html
http://www.amnxy.com/a/mendianyingxiao/20151207/158.html
http://www.amnxy.com/a/mendianyingxiao/20151210/195.html
http://www.amnxy.com/a/mendianyingxiao/20151210/197.html
http://www.amnxy.com/a/mendianzhanshi/yizhanshixihu/
http://www.amnxy.com/a/qita/liansuozhongguo/
http://www.amnxy.com/a/sanxingdiananli/20151116/107.html
http://www.amnxy.com/a/sanxingdiananli/20151116/108.html
http://www.amnxy.com/a/sanxingdiananli/20151116/109.html
http://www.amnxy.com/a/sanxingdiananli/20151116/113.html
http://www.amnxy.com/a/sanxingdiananli/20151209/177.html
http://www.amnxy.com/a/shuixishebei/20151116/137.html
http://www.amnxy.com/a/sixingdiananli/20151109/27.html
http://www.amnxy.com/a/sixingdiananli/20151109/28.html
http://www.amnxy.com/a/sixingdiananli/20151109/29.html
http://www.amnxy.com/a/sixingdiananli/20151209/178.html
http://www.amnxy.com/a/sixingdiananli/20151210/179.html
http://www.amnxy.com/a/sixingdiananli/20151210/180.html
http://www.amnxy.com/a/sixingdiananli/20151210/181.html
http://www.amnxy.com/a/sixingdiananli/20151210/182.html
http://www.amnxy.com/a/sixingdiananli/20151210/183.html
http://www.amnxy.com/a/sixingdiananli/20151210/184.html
http://www.amnxy.com/a/sixingdiananli/20151210/185.html
http://www.amnxy.com/a/sixingdiananli/20151210/186.html
http://www.amnxy.com/a/sixingdiananli/20151210/187.html
http://www.amnxy.com/a/sixingdiananli/20151210/188.html
http://www.amnxy.com/a/sixingdiananli/20151210/189.html
http://www.amnxy.com/a/sixingdiananli/20151210/190.html
http://www.amnxy.com/a/sixingdiananli/20151210/191.html
http://www.amnxy.com/a/sixingdiananli/20151210/192.html
http://www.amnxy.com/a/sixingdiananli/20151210/193.html
http://www.amnxy.com/a/sixingdiananli/20151210/194.html
http://www.amnxy.com/a/touzifangan/20151115/80.html
http://www.amnxy.com/a/touzifangan/20151115/81.html
http://www.amnxy.com/a/touzifangan/20151115/82.html
http://www.amnxy.com/a/touzifangan/20151207/153.html
http://www.amnxy.com/a/touzifangan/20151207/154.html
http://www.amnxy.com/a/touzifangan/20151207/155.html
http://www.amnxy.com/a/touzifangan/20151207/156.html
http://www.amnxy.com/a/woyaojiameng/jiamengzhichi/
http://www.amnxy.com/a/xingyedongtai/20151115/106.html
http://www.amnxy.com/a/xingyedongtai/20151205/149.html
http://www.amnxy.com/a/amanirongyu/2015/1109/49.html
http://www.amnxy.com/a/amanirongyu/2015/1109/50.html
http://www.amnxy.com/a/amanirongyu/2015/1109/51.html
http://www.amnxy.com/a/amanirongyu/2015/1109/52.html
http://www.amnxy.com/a/amanirongyu/2015/1109/53.html

在没安装OFFICE的服务器SSIS中进行EXCEL的ETL操作!的更多相关文章

  1. 在MFC中对Excel的一些操作

    首先要在程序中加载CExcel.h和CExcel.cpp文件,这里面包装了很多函数和对Excel文件的操作,下面所有程序中的m_excel都是类CExcel的对象,如: private: _Appli ...

  2. vbs中对excel的常用操作

    使用QTP自动化测试中,用到对excel的读写操作,这里把一些常用对excel操作的方法进行了归纳,总结.(对excel格式设置的常用操作这里没有进行总结.) Function DataToExcel ...

  3. C# 未安装Office环境下使用NPOI导出Excel文件

    1.NuGet直接安装NPOI程序包: 2. using NPOI.XSSF.UserModel; 3.导出Excel代码: private void TsbExport2ExcelClick(obj ...

  4. C#中导出EXCEL服务器端不用安装OFFICE

    在实际开发过程中,有时候服务器端没安装OFFICE,你和服务器管理员去商量安装个OFFICE的时候,管理员很倔犟的不给你安装的时候,这个时候就可以考虑我这个方法是实现导出EXCEL了.如果你导出的EX ...

  5. ASP.NET导出Excel(利用NPOI和EPPlus库,无需安装Office)

    网上提供了很多Asp.net中操作Excel的方法,其中大部分是调用微软的Office组件,下面提供三个无须安装Office即可从Asp.net输出Excel的方法. 1 简单方法 //下面代码输出的 ...

  6. C# 创建Excel或需不安装Office

    第一种.Aspose.Cells.dll //如果需要饶过office Excel那么就看我最后的实现方法吧~! //我最后的实现是使用的第三方Aspose.Cells.dll //具了解这个dll一 ...

  7. asp.net中通过注册表来检测是否安装Office(迅雷/QQ是否已安装)

    原文  asp.net中通过注册表来检测是否安装Office(迅雷/QQ是否已安装) 检测Office是否安装以及获取安装 路径 及安装版本  代码如下 复制代码 #region 检测Office是否 ...

  8. 在 Linux 中安装 Lighttpd Web 服务器

    Lighttpd 是一款开源 Web 服务器软件.Lighttpd 安全快速,符合行业标准,适配性强并且针对高配置环境进行了优化.相对于其它的 Web 服务器而言,Lighttpd 占用内存更少:因其 ...

  9. Ubuntu腾讯云主机安装分布式memcache服务器,C#中连接云主机进行存储的示例

    Ubuntu腾讯云主机安装分布式memcache服务器,C#中连接云主机进行存储的示例(github代码:https://github.com/qq719862911/MemcacheTestDemo ...

随机推荐

  1. Sale.js——快速创建促销样式

    小菜编写的又一款jQuery小插件,有兴趣的朋友可以试试~ 简介: 对于一个用于产品展示.销售的网站而言,很可能需要一种促销的特效. 一般而言,我们会在商品图片前加一个促销栏,写上一些促销标语.原价. ...

  2. C#课外实践——校园二手平台(心得篇)

    先声明一下,现在回头看一下自己做的小程序,感觉很不怎么地.但是通过这次的实践明白了很多的东西.至于程序实现的什么给你,通过名字就可以猜出来.不过,是客户端的.我想,这应该是我见过的第一个以客户端为模式 ...

  3. HighCharts之2D柱状图

    1.HighCharts之2D柱状图源码 column.html: <!DOCTYPE html> <html> <head> <meta charset=& ...

  4. Spirng quartz 整合

    以下是资料来源: quartz maven confighttp://quartz-scheduler.org/downloads Spring 定时器(Timer,Quartz)http://sup ...

  5. Java程序员的日常 —— 工作一天的收获

    看题目可能是扯皮,其实还是有很多专业知识的.从最开始没有注意到设计原则,到后面的jquery实战技巧,都是今天一天碰到的问题. 每天整理一点点,每天收获一点点. 关于软件设计 在设计系统结构的时候,一 ...

  6. swoole

    http://www.swoole.com/wiki/index/prid-1-p-project/road_map.html

  7. Emmet语法大全手册

    这是基于官方手册整理制作的,因为那个手册网页打开很慢,所以就整理在这里了.以备不时之需. Syntax   Child: > nav>ul>li <nav> <ul ...

  8. atitit。 hb Hibernate sql 查询使用

    atitit. hb  Hibernate sql 查询使用 #----------返回list<map>法..这个推荐使用.      q.setResultTransformer(Tr ...

  9. paip.批处理清理java项目冗余jar的方法

    paip.批处理清理java项目冗余jar的方法 在myeclipse中开发的java项目遇到jar包冗余情况,如何删除项目中的冗余jar包啊?项目很大jar包一百多个. 2010-09-14 14: ...

  10. js程序设计03——面向对象

    ECMAScript中有2中属性:数据属性.访问器属性. 数据属性是为了指定某对象的指定key上的一些行为,比如value是否可删除.修改.key可循环遍历等特点.而访问器属性不包含数据值,包含一堆g ...