在没安装OFFICE的服务器SSIS中进行EXCEL的ETL操作!
由于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操作!的更多相关文章
- 在MFC中对Excel的一些操作
首先要在程序中加载CExcel.h和CExcel.cpp文件,这里面包装了很多函数和对Excel文件的操作,下面所有程序中的m_excel都是类CExcel的对象,如: private: _Appli ...
- vbs中对excel的常用操作
使用QTP自动化测试中,用到对excel的读写操作,这里把一些常用对excel操作的方法进行了归纳,总结.(对excel格式设置的常用操作这里没有进行总结.) Function DataToExcel ...
- C# 未安装Office环境下使用NPOI导出Excel文件
1.NuGet直接安装NPOI程序包: 2. using NPOI.XSSF.UserModel; 3.导出Excel代码: private void TsbExport2ExcelClick(obj ...
- C#中导出EXCEL服务器端不用安装OFFICE
在实际开发过程中,有时候服务器端没安装OFFICE,你和服务器管理员去商量安装个OFFICE的时候,管理员很倔犟的不给你安装的时候,这个时候就可以考虑我这个方法是实现导出EXCEL了.如果你导出的EX ...
- ASP.NET导出Excel(利用NPOI和EPPlus库,无需安装Office)
网上提供了很多Asp.net中操作Excel的方法,其中大部分是调用微软的Office组件,下面提供三个无须安装Office即可从Asp.net输出Excel的方法. 1 简单方法 //下面代码输出的 ...
- C# 创建Excel或需不安装Office
第一种.Aspose.Cells.dll //如果需要饶过office Excel那么就看我最后的实现方法吧~! //我最后的实现是使用的第三方Aspose.Cells.dll //具了解这个dll一 ...
- asp.net中通过注册表来检测是否安装Office(迅雷/QQ是否已安装)
原文 asp.net中通过注册表来检测是否安装Office(迅雷/QQ是否已安装) 检测Office是否安装以及获取安装 路径 及安装版本 代码如下 复制代码 #region 检测Office是否 ...
- 在 Linux 中安装 Lighttpd Web 服务器
Lighttpd 是一款开源 Web 服务器软件.Lighttpd 安全快速,符合行业标准,适配性强并且针对高配置环境进行了优化.相对于其它的 Web 服务器而言,Lighttpd 占用内存更少:因其 ...
- Ubuntu腾讯云主机安装分布式memcache服务器,C#中连接云主机进行存储的示例
Ubuntu腾讯云主机安装分布式memcache服务器,C#中连接云主机进行存储的示例(github代码:https://github.com/qq719862911/MemcacheTestDemo ...
随机推荐
- ASP.NET 5系列教程 (六): 在 MVC6 中创建 Web API
ASP.NET 5.0 的主要目标之一是统一MVC 和 Web API 框架应用. 接下来几篇文章中您会了解以下内容: ASP.NET MVC 6 中创建简单的web API. 如何从空的项目模板中启 ...
- 【Android】混淆器(ProGuard)
混淆器(ProGuard) 混淆器通过删除从未用过的代码和使用晦涩名字重命名类.字段和方法,对代码进行压缩,优化和混淆.结果是一个比较小的.apk文件,该文件比较难进行逆向工程.因此,当你的应用程序对 ...
- JS open App(未安装就跳转下载页面)
直接上代码var APPCommon = { downAppURl : "http://**/",//下载APP地址 downWeixin: "http://**&quo ...
- Leetcode 168 Excel Sheet Column Title 进制数转化
题意:将数字转化成excel表中的行中的项目 本质是10进制转化为26进制,但是在中间加入了一个不一样的操作,在每次操作前都需要n-- class Solution { public: string ...
- MVC5为WebAPI添加命名空间的支持
前言 默认情况下,微软提供的MVC框架模板中,WebAPI路由是不支持Namespace参数的.这导致一些比较大型的项目,无法把WebApi分离到单独的类库中. 本文将提供解决该问题的方案. 微软官方 ...
- 在ArcGIS空间数据库中增加点数据的方法
1.新建一个mxd(ArcMAP)文件 2.从ArcCatalog中把要编辑的图层拖到ArcMAP中 3.从ArcCatalog中拖一个参照图层到ArcMAP中,比如临沂市的县级区划图 4.打开Edi ...
- 15系统函数&数据类型转换(必学)-大话数据库视频教程
大纲:系统函数的用法,case...when的用法,cast关键字的用法,convert的用法 优酷超清地址: 腾讯超清地址: 百度网盘下载地址:http://pan.baidu.com/s/1dDe ...
- SQL 游标使用实例
IF EXISTS(SELECT *FROM sysobjects WHERE name='sp_ContestSubmit') DROP PROC sp_ContestSubmit GO -- == ...
- [LeetCode] Serialize and Deserialize Binary Tree
Serialize and Deserialize Binary Tree Serialization is the process of converting a data structure or ...
- 新安装的VS的一些设置
古语云:工欲善其事必先利其器 为了方便我们开发,应该设置好VS的一些配置,安装一些辅助插件 1 设置字体和背景等 设置字体为 console 10大小 背景设为护眼颜色 85 90 205 这三个值 ...