Assuming you are trying to read the contents of the Excel files and not the 
shortcut itself, try something link this:

#C:\users\mark\desktop\A1.xlsx.lnk is a shortcut I created on my desktop to an 
xlsx document in another directory
#The windows type command, along with find gets the path to the actual file 
from the shortcut
cmd<-'type c:\\users\\mark\\desktop\\A1.xlsx.lnk|find "\\"|findstr/b 
"[a-z]:[\\\\]'
XLFileName<-shell(cmd, intern=T)
read.xlsx(XLFileName, 1)

I hope this helps.


--Mark J. Lamias



________________________________
 From: Santosh <santosh2...@gmail.com>
To: r-help <r-help@r-project.org> 
Sent: Thursday, September 26, 2013 4:54 PM
Subject: [R] Read shortcuts of MS Excel files through R


Dear Rxperts,

Through Windows OS, I created shortcuts (paste as shortcut) to excel
spreadsheets ( with "xlsx" as the file extension). I wasn't able to read
the shortcuts through R and using "read" functions of "xlsx" package.

exf <- "a1.xlsx.lnk"

> read.xlsx(exf,1)
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
  java.lang.IllegalArgumentException: Your InputStream was neither an OLE2
stream, nor an OOXML stream
> read.xlsx2(exf,1)
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
  java.lang.IllegalArgumentException: Your InputStream was neither an OLE2
stream, nor an OOXML stream


Would truly appreciate your suggestions.

Regards,
Santosh

    [[alternative HTML version deleted]]

______________________________________________
R-help@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.
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to