[R] Read shortcuts of MS Excel files through R

Marc Schwartz marc_schwartz at me.com
Fri Sep 27 02:43:16 CEST 2013


Hi,

I am not on Windows so cannot test this, but a search reveals that in the R.utils CRAN package by Henrik Bengtsson, there is the readWindowsShortcut() function which may provide some assistance in getting the path to the actual file.

Thus:
   
  install.package("R.utils", dependencies = TRUE) # depends upon 'R.oo'
  require(R.utils)
  ?readWindowsShortcut


Regards,

Marc Schwartz


On Sep 26, 2013, at 5:05 PM, Sarah Goslee <sarah.goslee at gmail.com> wrote:

> Hi,
> 
> On Thu, Sep 26, 2013 at 4:54 PM, Santosh <santosh2005 at gmail.com> wrote:
>> 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.
> 
> A shortcut isn't an Excel file: it's the operating system that figures
> that out. The shortcut itself is just a note to Windows with a file
> reference in it. I wouldn't expect R to be able to parse that
> reference.
> 
> Sarah
> 
> 
>> 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
>> 
> 
> 
> -- 
> Sarah Goslee
> http://www.functionaldiversity.org
> 
> ______________________________________________
> 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.



More information about the R-help mailing list