Home » Solved: Error in file(con, “r”) : invalid ‘description’ argument

Solved: Error in file(con, “r”) : invalid ‘description’ argument

  • by
  • 1 min read

A couple of months ago I wrote a short blog post about a new library I discovered: openxlsx. Here’s a very short blog post as a followup.

To read in Excel files in R using the openxlsx library, I use the following function:

read.xlsx('file.xlsx')

However, one day, I ran into the following error.

Error in file(con, “r”) : invalid ‘description’ argument

I lost half an hour trying to solve this error, so I’m gonna save you the troubles: if you have the file opened in Microsoft Excel or a free alternative, just close it ;-).

Good luck!

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.