All of a sudden R does not read my excel files

So today all of a sudden R does not read my excel files. I made absolutely no change on my computer. My working directory is "C:/Users/Ilias Iliadis/OneDrive/Documents" (i got this with getwd() ).

This is the error message that is displayed: Error in read.xlsx.default("GerBiogas") : File does not exist.

GerBiogas is the file i am trying to load. I am absolutely sure it is in the correct folder and i spell it properly. The file is also in xlsx form. I unistalled and reinstalled R but the problem remains.

Do you have any idea was is going on? All of a sudden i cannot load any of my files.

I am trying to load it with this:

read.xlsx("GerBiogas") i also tried to specify the path: read.xlsx("C:\Users\Ilias Iliadis\OneDrive\Documents\GerBiogas.xlsx")

Again it does not work. I am using R version 4.2.2.

I personally wouldn't use library(xlsx) (which I believe contains your read.xlsx) because it has a java dependency...
I use library(readxl)
Though some functions would perhaps guess the associated extension, if my issue with loading a file into R met up against file not found issues, then I would certainly go with including the extension for the avoidance of doubt.
I guess from your working directory; you are likely a windows user.
When you reported getwd() the slashes were / ; which is common. going the other way without doubling up would not be expected to work... i.e. C:\\Users\xxx yes, C:\Users\xxx no ; but as shows C:/Users/xxx also yes. but I would expect you to have actual error related to that, i.e.

Error: '\U' used without hex digits in character string starting ""C:\U"

best way to deal with I cant load my file as the packaged R function says it doesnt exist, is use R base functions to list the files in your directory; and verify the precise name and existence of the file. i.e. for you

list.files("C:/Users/Ilias Iliadis/OneDrive/Documents")

does it contain an entry for "GerBiogas.xlsx" precisely ? or slightly different ? or not at all.

file.exists("C:/Users/Ilias Iliadis/OneDrive/Documents/GerBiogas.xlsx")

if this is TRUE , then the function you try to use to read that, should indeed not complain about the file not existing...

anyways, good luck.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.