可以在c#程序中调用excel表中的数据吗? [英] Can data from excel sheet be called in a c# program?

查看:57
本文介绍了可以在c#程序中调用excel表中的数据吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在excel表上有来自用户的数据。我需要在逻辑中使用该数据。那么可以在运行代码时调用excel数据吗?

I have the data from the user on an excel sheet. I need to use that data in the logic. So is it possible to call an excel data in while running the code ?

推荐答案

如果你只是在讨论c#中的'使用Excel数据',你有一个数字选项



1)将excel中的数据作为csv / tsv导出到文件并在c#中读取该文件:easy



2)使用来自C#的Excel Interop:方式更复杂 - 一开始就看这个(但你可能需要做更多的研究) http://www.dotnetperls.com/excel [ ^ ]



3)我相信你可以使用ADO.NET从Excel电子表格中读取数据 - 你需要谷歌的'如何设置它'



4)可能有第三方解决方案可以免费阅读Excel电子表格



显然1,2,3,4的选择取决于许多事情,我们无法确定这些事情您提供的信息
If you are just talking about 'using Excel data' from c#, you have a number of options

1) export the data from excel as csv/tsv to a file and read that file in c# : easy

2) use Excel Interop from C# : Way more complex - see this for a start (but you'll need to do a lot more research' likely) http://www.dotnetperls.com/excel[^]

3) I believe you can use ADO.NET to read data from an Excel spreadsheet - you'll need to Google for 'how to set it up'

4) There may be 3rd party solutions free or not that can read Excel Spreadsheets

obviously the choice on 1,2,3,4 depends on many things, none of which we can ascertain on the information you've provided


参见使用MS Excel(xls / xlsx)使用MDAC和Oledb [ ^ ]。


这篇关于可以在c#程序中调用excel表中的数据吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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