在上传为blob蔚蓝读excelsheet [英] read excelsheet in azure uploaded as a blob

查看:139
本文介绍了在上传为blob蔚蓝读excelsheet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用asp.net的FileUpload控件,并与一些数据上传Excel中。我不能将其保存在某个文件夹。我能有Excel工作表的文件流或上传Excel作为一个blob后我可以有Blobstream。现在我想将其转换Excel工作表第1张数据表来,所以我应该怎么做呢?我使用C#.NET。我不想使用互操作库。我可以使用外部库。 OLEDB连接是越来越失败,因为我没有Excel作为数据源的物理路径。我尝试以下链接:

I am using FileUpload control of asp.net and uploading the excel with some data. I can't save it in some folder. I can have stream of excel sheet file or I can have Blobstream after uploading excel as a blob. Now I want to convert that excel sheets 1st sheet to datatable so how shall I do that? I am using C# .NET. I don't want to use Interop library. I can use external libraries. Oledb connection is getting failed since I don't have any physical path of excel as a data source. I tried following links:

1)http://www.$c$cproject.com/Articles/14639/Fast-Excel-file-reader-with-basic-functionality

2) HTTP://exceldatareader.$c$cplex.com/

请帮忙。

推荐答案

根据的Excel文件类型,您可以使用您发布的例子,或去为OpenXML的选择项(XLSX文件)的 HTTP://openexcel.$c$cplex.com/

Depending on the type of Excel file you can use the examples you posted or go for the OpenXML alternative (for xlsx files): http://openexcel.codeplex.com/

现在,用物理路径的问题很容易解决。将文件保存到Blob存储是伟大的。但是,如果你愿意,你可以同时保存在一个本地资源有本地。这将允许您处理使用一个简单的OLEDB连接文件。一旦你对文件做,你可以刚刚从本地资源删除它(它仍然是在Blob存储可用,因为你还上传了它那里)。

Now, the problem with the physical path is easy to solve. Saving the file to blob storage is great. But if you want, you can also save it in a local resource to have it locally. This will allow you to process the file using a simple OleDb connection. Once you're done with the file, you can just delete it from the local resource (it will still be available in the blob storage since you also uploaded it there).

不要忘了在案件某种清理机制的处理失败。你不会希望与充满临时文件(即使它可能需要一段时间这种情况发生之前)的磁盘就结了。

Don't forget to have some kind of clean up mechanism in case your processing fails. You wouldn't want to end up with a disk filled with temporary files (even though it could take a while before this happens).

了解更多关于这里本地资源: http://msdn.microsoft .COM / EN-US /库/ windowsazure / ee758708.aspx

Read more on local resources here: http://msdn.microsoft.com/en-us/library/windowsazure/ee758708.aspx

这篇关于在上传为blob蔚蓝读excelsheet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆