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:


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 ;-).

By the way, if you’re having trouble understanding some of the code and concepts, I can highly recommend “An Introduction to Statistical Learning: with Applications in R”, which is the must-have data science bible. If you simply need an introduction into R, and less into the Data Science part, I can absolutely recommend this book by Richard Cotton. Hope it helps!

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.