如何使用控制台应用程序从特定位置下载excel文件? [英] How can I download an excel file from a specific location using Console application?

查看:123
本文介绍了如何使用控制台应用程序从特定位置下载excel文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用控制台应用程序从特定位置下载Excel文件?我试过myWebClient.DownloadFile(myStringWebResource,fileName);即使我没有得到任何例外,它对我不起作用。要求就像是,我们必须从数据表中获取excel表,并且应该像Web应用程序一样下载。如果可能的话,有人可以最早帮助我。

在此先感谢

How can I download an excel file from a specific location using Console application? I have tried with myWebClient.DownloadFile(myStringWebResource, fileName); even though I am not getting any exception, It is not working for me. The requirement is like, we have to get the excel sheet filled from datatable and should get downloaded as what happens with web application. Can someone please help me at the earliest, if possible.?
Thanks in advance

推荐答案

使用下面的代码,你应该添加
use below code you should add
using System.Net;

运行此代码

如果有任何问题,请随时再次询问具体问题详情。并且不要忘记显示你的code.happy编码:)



to run this code
if there any problem then feel free to ask again with specific problem details. and don't forget to show your code.happy coding :)

static void Main(string[] args)
{
    using (WebClient wc = new WebClient())
    {
        wc.DownloadFile("http://www.kanpuruniversity.org/SYLLABUS/BSc_Biotech_%20Single_Subject.pdf", "c:\\Single_Subject.pdf");
    }
}


这篇关于如何使用控制台应用程序从特定位置下载excel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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