Hello Everyone and thanks for your help in advance. I have an application that needs to download many files from a website. One of these files is an Excel spreadsheet. My code downloads the file, but when I go to open it, the data is scrambled. I think the
problem is that I am encoding it improperly, but can't figure out what I nned to do. The following code is what I am using now: 'Put user code to initialize the page here Dim URL As String = "http://filetoget.xls Dim outputfile As String = "C:\filetoget.xls"
Dim wReq As WebRequest Dim wResp As WebResponse Dim respStream As Stream Dim reader As StreamReader Dim writer As StreamWriter ' create the Web Request wReq = WebRequest.Create(URL) ' get the response wResp = wReq.GetResponse() respStream = wResp.GetResponseStream()
reader = New StreamReader(respStream, False) ' and write it to the required file writer = New StreamWriter(outputfile) 'writer = New BinaryWriter(outputfile) writer.Write(reader.ReadToEnd()) Could someone get me going in the right direction? Any help is greatly
appreciated. Thanks.
kmcnet
Participant
1090 Points
652 Posts
Downloading Excel Files
Oct 28, 2004 04:42 PM|LINK