如何从FTP读取excel文件并在不下载的情况下加载到datatable中 [英] How to read the excel file from FTP and load in datatable without downloading

查看:334
本文介绍了如何从FTP读取excel文件并在不下载的情况下加载到datatable中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,



我在从FTP读取数据时遇到一些困难。我已从FTP下载文件并在本地保存,当我尝试读取excel时,我收到以下错误。



外部表是不是预期的格式。



如果我保存带有其他名称的文件,另存为,当我正在阅读它的工作时。



我观察到当我保存时文件大小约为33 kb。保存前原始文件大小为9 kb。



能告诉我问题所在并帮助我。



先谢谢。



谢谢,

Sujju





我尝试了什么:



我保存了文件保存为和读取文件工作。但是从FTP下载的原始文件无效。

Hello Everyone,

I am facing some difficulty in reading the data from FTP. I have downloaded the file from FTP and saved locally and when I am try to read to the excel I am getting the below error.

"External table is not in the expected format".

If I am save the file with other name with save as, when I am reading its working.

I observed that when I am save as the file size is coming some 33 kb. Before save as original file size is 9 kb.

Can you please let me know where the issue is and help me.

Thanks in advance.

Thanks,
Sujju


What I have tried:

I saved the file with save as and reading the file its working. But original file downloaded from FTP is not working.

推荐答案

你可能使用了错误的连接字符串。



对于XLSX文件:

Provider = Microsoft.ACE.OLEDB.12.0; Data Source =+ [filepath] +; Extended Properties = Excel 12.0;



对于XLS文件:

Provider = Microsoft.Jet.OLEDB。 4.0; &安培; 数据源=+ [文件路径] +;扩展属性=Excel 8.0; HDR = YES;
You're probably using the wrong connection string.

For XLSX files:
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + [filepath] + ";Extended Properties=Excel 12.0";

For XLS files:
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + [filepath] + ";Extended Properties="Excel 8.0;HDR=YES;"


这篇关于如何从FTP读取excel文件并在不下载的情况下加载到datatable中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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