Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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
Posted
Comments
Richard MacCutchan 2-Feb-16 9:12am    
What do you mean by "It is not working for me"?
We cannot see your screen or guess what is in your mind; you need to explain in proper detail.
Anisuzzaman Sumon 2-Feb-16 9:40am    
Please show us your code

1 solution

use below code you should add
C#
using System.Net;
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 :)

C#
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");
    }
}
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900