I tried installing java and using the XLConnect package mmethods (both of them) but I get an error that looks like this:
Error: IOException (Java): Your InputStream was neither an OLE2 stream, nor an OOXML stream
I am definitely not trying to load an empty file, and I definitely do have access to/permission to read from the file location. What might I be doing wrong?
I tried installing java and using the XLConnect package mmethods (both of them) but I get an error that looks like this:
Error: IOException (Java): Your InputStream was neither an OLE2 stream, nor an OOXML stream
I am definitely not trying to load an empty file, and I definitely do have access to/permission to read from the file location. What might I be doing wrong?
I've investigated these related questions without success.
Importing Excel files into R, xlsx or xls
R read_excel: libxls error: Unable to parse file
Check the below code, it works with library(readxl)
xls and xslx both work
Related
The read_excel() function works fine if I close the file in MS Excel, but if the file is opened, the error message pops up:
Error: Evaluation error: zip file 'plot_Regional comparison_cum2.xlsx'
cannot be opened.
I used to read excel fine with my excel file open so I would like to know if there's a way to fix this. Some suggestions said the file restriction in MS can be modified, but not sure how to do that.
Any suggestions will be much appreciated!
I need to be able to read a sheet from an xlsx workbook into R for use in a Shiny app. (I know it should be a csv file, but that is unfortunately not my decision...).(Edited to add: The file I need to read is on dropbox) I am trying to use the repmis package. The code I have tried is simply:
library('repmis')
library('xlsx')
lnk<-"https://www.dropbox.com/s/pzyt86pguko3xg6/TestBook.xlsx?dl=0"
my_data<-source_XlsxData(lnk, sheet="MainData", startRow=1)
Unfortunately I get the following error message:
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream
I have no idea what it means... :|
I think a recent update removed the ability to read data files stored on Dropbox from within R. I will go look for confirmation, and delete my comment otherwise.
Source: Ran into the same issue myself a couple of months ago
UPDATE: Confirmation of dropped support within the github package https://github.com/christophergandrud/repmis/commit/f85469f38c6f4e4a5735ecc888b4263b969d4e22
So basically I succesfully exported my SQL view data into a csv file. but no when I load into Rgui software, I get the following errror:
> load("C:\\Users\\dachen\\Documents\\vTargetBuyers.csv")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘vTargetBuyers.csv’ has magic number 'Marit'
Use of save versions prior to 2 is deprecated
What should I do? Is it the R version installed wrong? or something wrong with my CSV file?
Try using read.csv instead of load. load is for reading files created by save.
Type ?read.csv to access the documentation.
I am using a data set that has been provided in an xlsx workbook across several worksheets. I created a function to extract the data from one of the sheets and reformat it into a usable form.
Opening the file twice in one compilation of Latex often (but not all the time) triggers the following error:
Error in unzip(xlsxFile, exdir = xmlDir) :
cannot open file 'C:/Users/Jonno/AppData/Local/Temp/RtmpewoYVY/_excelXMLRead/xl/worksheets/sheet5.xml': Permission denied
This suggests that the temporary file is not being closed which prevents openxlsx from unzipping the xlsx file again.
Unfortunately the file needs to be opened several times to extract the data.
Also unfortunately I haven't been able to create a reproducible example suggests that it may be something to do with the structure of the file I have received.
Is there a way to force the temporary file to be closed and deleted after each time it is opened?
This problem only occurs when knitting, when it is run in the R enivironment this problem never occurs.
Every time I enter this line
cameradata <- read.xlsx("./data/cameras.xlsx" , 1)
I get error:
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod",
cl, : java.util.zip.ZipException: invalid entry size (expected 500
but got 502 bytes)
I have tried to clear RAM but file size is 10kp
Try this :-
May be this can work. It worked for me
1) when downloading the xlsx file, use this
download.file(fileURL, destfile="./whatever", mode="wb")
2) Switched to regular R, not R Studio,
The xlsx file you are trying to read maybe damaged. Try redownload the file or read another "healthy" xlsx file.
I had experience exactly the same issue.
What I did to resolve the problem was:
I had defined separate variable "fileURL2" and assigned "XLSX" download link
I had defined separate variable "cameraData2" and loaded XLSX file to it
I had downloaded file directly with Firefox and open it with MS Excel to assure it is OK, then I had save it to the working directory of "R" overwriting existing "cameras.xlsx" file
After new attempt to read the file with "R" read.xlsx() - was successful
In conclusion it seems that "R" had corrupted XLSX file during the download - which might be caused by a BUG inside of current version of the language.