Import Excel Tables into R

Asked

Viewed 1,375 times

2

I would like to know which is the best library to import excel tables to be manipulated in R. I would like one that supports all extensions, mainly the . xlsm.

  • I had already read this topic, but it didn’t work for me.

  • There are 3 solutions. One of them is identical to the answer you accepted..

  • I tested the 3 and they didn’t work.

  • you tested that? https://answall.com/a/159395/6036

  • I installed the library, followed the example step by step. But just when I have the library set up with the library("readxl") command it already gives me an alert message warning that the package was made in a previous R to the one I use - version 3.3.3 x64. What could I do to solve this?

  • this Warning is not a problem!! he is just saying that his version of R is outdated.

Show 1 more comment

1 answer

4


I found a way to do the reading with the package XLConnect.

require(XLConnect)

dados <- readWorksheetFromFile("Pasta1.xlsm", sheet=1)

Here it worked for a very simple set of data saved in xlsm.

This package is for various types of excel file. But the most common form (for .xls and .xlsx) is the one you described earlier:

According to the answer in this topic of Stackoverflow, is possible to read with the xlsx package R, with the command read.xlsx or read.xlsx2. I believe it works for xlsm, though I can’t say for sure because I’ve never used for this format.

This package makes it possible to read various formats used in Excel, such as csv, xls and xlsx. I believe it also works for xlsb and xlsm.

I hope this time it helps!

  • I tested this function, but it didn’t work for the .xlsm. I’ll keep searching. Thank you very much!

  • I think with this edition I did solves your problem. It worked in a simple test I did.

  • I managed to install the package, but it gives an error saying that "perl" was not found and also that it was building in an earlier version.

  • This for Xlconnect? Because now that I saw it, I had put the wrong package in require. It was supposed to be Xlconnect itself

  • Now I was able to launch the package! But, it is not locating the spreadsheet. I tried to include the worksheet path, but then it gives parameterization error. It’ll be like I could fix it?

  • Can you post the error message? (and also how you passed the path?)

  • > data <- readWorksheetFromFile("BRFS3.xlsm", sheet=2)</br> Error: Filenotfoundexception (Java): File 'BRFS3.xlsm' could not be found - you may specify to Automatically create the file if not existing. </br> > date <- readWorksheetFromFile("D: Invest Sheet 2017 selectedBRFS3.xlsm", sheet=2)</br> Error: 'F' is an unrecognized escape string in the string starting with ""D: F"

  • Try with: readWorksheetFromFile("D: Invest Sheet 2017 selects BRFS3.xlsm", sheet=2) R interprets '' as a special character. You need to put (double) to understand it as part of the address, or replace pot '/'. :)

  • Now it worked! Thank you very much!

  • Show :) !

Show 5 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.