Hi Download the xls file from this link http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls <http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls> I tried this --------------------------------------------------------------- library(XLConnect) url = "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" local.xls.file = tempfile() download.file(url, local.xls.file) wb = loadWorkbook(local.xls.file, create=F) data = readWorksheet(wb, sheet=1) View(data) --------------------------------------------------------------- no results ... kindly help me thanks veepsirtt -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646215.html Sent from the R help mailing list archive at Nabble.com.
Download a file from url
9 messages · Rui Barradas, veepsirtt, Brian Ripley +1 more
Hello, Your page returns "access denied": library(RCurl) url <- "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" xls <- getURL(url) cat(xls) <HTML><HEAD> <TITLE>Access Denied</TITLE> </HEAD><BODY> <H1>Access Denied</H1> You don't have permission to access "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" on this server.<P> Reference #18.f0241c2.1350314817.23d7e0e0 </BODY> </HTML> Also, start a new thread when you want to ask a new question. Hope this helps, Rui Barradas Em 15-10-2012 09:57, veepsirtt escreveu:
Hi Download the xls file from this link http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls <http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls> I tried this --------------------------------------------------------------- library(XLConnect) url = "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" local.xls.file = tempfile() download.file(url, local.xls.file) wb = loadWorkbook(local.xls.file, create=F) data = readWorksheet(wb, sheet=1) View(data) --------------------------------------------------------------- no results ... kindly help me thanks veepsirtt -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646215.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Mr Jeffrey Breen mailed me the following code. but it is not giving me the results under Windows 7. With regards veepsirtt' library(XLConnect) url = "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" local.xls.file = tempfile() download.file(url, local.xls.file, method='wget', extra="-U 'Mozilla/5.0 (X11; Linux) Gecko Firefox/5.0'") wb = loadWorkbook(local.xls.file, create=F) data = readWorksheet(wb, sheet=1) -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646252.html Sent from the R help mailing list archive at Nabble.com.
You didn't say what errors you've got but you probably wants to specify argument mode="wb" in your download.file() call, cf. https://stat.ethz.ch/pipermail/r-devel/2012-August/064739.html /Henrik
On Mon, Oct 15, 2012 at 1:57 AM, veepsirtt <veepsirtt at gmail.com> wrote:
Hi Download the xls file from this link http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls <http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls> I tried this --------------------------------------------------------------- library(XLConnect) url = "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" local.xls.file = tempfile() download.file(url, local.xls.file) wb = loadWorkbook(local.xls.file, create=F) data = readWorksheet(wb, sheet=1) View(data) --------------------------------------------------------------- no results ... kindly help me thanks veepsirtt -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646215.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121015/eacef793/attachment.pl>
Currently download methods "internal", "wget", "curl" and "lynx" are available. If wget is not possible under windows,how to use 'curl'?. thanks veepsirtt -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646296.html Sent from the R help mailing list archive at Nabble.com.
On 16/10/2012 02:33, veepsirtt wrote:
Currently download methods "internal", "wget", "curl" and "lynx" are available. If wget is not possible under windows,how to use 'curl'?.
But it is. You need the programs wget or curl installed and in your path: pre-compiled versions for Windows are available if you look.
thanks veepsirtt -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646296.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
PLEASE do: you have lost all the context here: you are posting to R-help and not to Nabble.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Hello Prof Brian Ripley I installed wget for windows from http://users.ugent.be/~bpuype/wget/ <http://users.ugent.be/~bpuype/wget/> and got the results very thanks veepsirtt --------------------------------------------------------------------------------------------------------------------------------------------------
library(XLConnect) url = "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" local.xls.file = tempfile() download.file(url, local.xls.file, method='wget', extra="-U 'Mozilla/5.0 (X11; Linux) Gecko Firefox/5.0'")
--2012-10-16 14:44:36-- http://(x11;/ Resolving (x11;... failed: Unknown host. wget: unable to resolve host address `(x11;' --2012-10-16 14:44:36-- http://linux)/ Resolving linux)... failed: Unknown host. wget: unable to resolve host address `linux)' --2012-10-16 14:44:36-- http://gecko/ Resolving gecko... failed: Unknown host. wget: unable to resolve host address `gecko' --2012-10-16 14:44:36-- http://firefox/5.0' Resolving firefox... failed: Unknown host. wget: unable to resolve host address `firefox' --2012-10-16 14:44:37-- http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls Resolving www.nseindia.com... 124.124.252.97, 124.124.252.107 Connecting to www.nseindia.com|124.124.252.97|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 24576 (24K) [application/vnd.ms-excel] Saving to: `C:/Users/Acer/AppData/Local/Temp/Rtmpqa0fd0/file1828c40257e' 0K .......... .......... .... 100% 5.26K=4.6s 2012-10-16 14:44:44 (5.26 KB/s) - `C:/Users/Acer/AppData/Local/Temp/Rtmpqa0fd0/file1828c40257e' saved [24576/24576] FINISHED --2012-10-16 14:44:44-- Downloaded: 1 files, 24K in 4.6s (5.26 KB/s)
wb = loadWorkbook(local.xls.file, create=F) data = readWorksheet(wb, sheet=1) na.omit(data)
FII.DERIVATIVES.STATISTICS.FOR.12.Oct.2012 Col1 Col2
Col3
3 INDEX FUTURES 40230.0 1142.001965025
51478.0
4 INDEX OPTIONS 525745.0 14990.371
492126.0
5 STOCK FUTURES 35248.0 1028.378075
45162.0
6 STOCK OPTIONS 105001.0 3212.669375
105553.0
Col4 Col5 Col6
3 1430.472715225 603867.0 15419.5277629
4 14070.52175 1783758.0 50627.34217375
5 1308.1875375 1041481.0 30630.1147675
6 3230.074875 80391.0 2505.014379375
----------------------------------------------------------------------------------------------------------------------------- -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646313.html Sent from the R help mailing list archive at Nabble.com.
Have you tried downloading it manually using a web browser or similar? If so, compare that downloaded file to that you get from download.file() and see if they're the same. If the same, the problem is elsewhere (which is not unlikely to be the case). /H
On Mon, Oct 15, 2012 at 6:15 PM, veepsirtt <veepsirtt at gmail.com> wrote:
Hi Henrik, i included the mode='wb' but gives me this error. What is the other method to download the excel file?. With kind regards veepsirtt library(XLConnect)
url = "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" local.xls.file = tempfile() download.file(url, local.xls.file, method='wget', mode='wb',extra="-U
'Mozilla/5.0 (X11; Linux) Gecko Firefox/5.0'") Warning message: In download.file(url, local.xls.file, method = "wget", mode = "wb", : download had nonzero exit status
wb = loadWorkbook(local.xls.file, create=F)
Error: FileNotFoundException (Java): File 'filed0c141444d8' could not be found - you may specify to automatically create the file if not existing.
data = readWorksheet(wb, sheet=1)
Error in readWorksheet(wb, sheet = 1) : error in evaluating the argument 'object' in selecting a method for function 'readWorksheet': Error: object 'wb' not found
On Mon, Oct 15, 2012 at 11:58 PM, Henrik Bengtsson-3 [via R] < ml-node+s789695n4646268h88 at n4.nabble.com> wrote:
You didn't say what errors you've got but you probably wants to specify argument mode="wb" in your download.file() call, cf. https://stat.ethz.ch/pipermail/r-devel/2012-August/064739.html /Henrik On Mon, Oct 15, 2012 at 1:57 AM, veepsirtt <[hidden email]<http://user/SendEmail.jtp?type=node&node=4646268&i=0>> wrote:
Hi Download the xls file from this link http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls <http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls> I tried this --------------------------------------------------------------- library(XLConnect) url = "http://www.nseindia.com/content/fo/fii_stats_12-Oct-2012.xls" local.xls.file = tempfile() download.file(url, local.xls.file) wb = loadWorkbook(local.xls.file, create=F) data = readWorksheet(wb, sheet=1) View(data) --------------------------------------------------------------- no results ... kindly help me thanks veepsirtt -- View this message in context:
Sent from the R help mailing list archive at Nabble.com.
______________________________________________ [hidden email] <http://user/SendEmail.jtp?type=node&node=4646268&i=1>mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ [hidden email] <http://user/SendEmail.jtp?type=node&node=4646268&i=2>mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646268.html To unsubscribe from Download a file from url, click here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4642985&code=dmVlcHNpcnR0QGdtYWlsLmNvbXw0NjQyOTg1fDY5NzkzMTE3Nw==> . NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
-- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4646295.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.