Questions tagged [readxl]

an R package that can be used to import Excel (.xls and .xlsx) files into R

The readxl package can be used to import Excel (.xls and .xlsx) files into R. It has no external dependencies (the libxls C library is embedded) and works on Windows, Mac, and Linux.

Resources

356 questions
5
votes
1 answer

Machine specific slow read_excel read times

I'm getting really slow read times using read_excel on a particular machine with a particular xlsm file. Reading the same xlsm file across 2 different machines I get read times of 72 seconds versus 0.2 seconds. Where the slower machine actually has…
Will T-E
  • 607
  • 1
  • 7
  • 16
5
votes
2 answers

read_excel correctly imports file, but "invalid multibyte string" error when trying to put it on a list

When I read any of the sheets from the file Posti-Letto-Istat.xls with read_excel from the readxl package I have no problems: library(readxl) pl_istat1 <- read_excel(path = "data/Posti-Letto-Istat.xls", sheet = 1, range = "A6:I66", na =…
Max
  • 85
  • 1
  • 7
5
votes
2 answers

Read column names as date format

I have date in Excel as follows, first col1 as char and from col2 to col5 is in date format (mm/dd/yyyy) id 1/1/2016 2/1/2016 3/1/2016 4/1/2016 5/1/2016 1 23 545 33 55 66 2 454 536 66 …
user5860640
  • 71
  • 2
  • 7
5
votes
1 answer

Using read_excel(na = ) how do you specify more than one NA character string?

I'm trying to read into R an excel sheet that uses multiple values for NA (specifically, "N/A" and "n/a"). If I try to give na= a list of strings it throws an error: read_excel(path = "file.xlsx", na = "N/A") #This works just…
Watanake
  • 263
  • 3
  • 9
5
votes
1 answer

read_excel read in messages- Suppress?

I love using the readxl package. However, I've been using it as part of an RMarkdown document and some of the read_excel() message when reading in files are useful when doing analysis but not when trying to present the analysis. So the question is,…
boshek
  • 4,100
  • 1
  • 31
  • 55
5
votes
6 answers

Error message using read_excel "Error: std::bad_alloc"

I'm trying to open an Excel file with the read_excel() function from the readxl package. But I don't know how to specify the path to the Excel file. When I enter the file path by following the steps given in the answer, I receive the error: "Error:…
ribery77
  • 141
  • 1
  • 3
  • 8
4
votes
1 answer

Make readxl::read_excel rename only the second duplicate column in R

In readr, the read_csv command handles duplicate column names by renaming the second duplicate and leaves the first unaltered. See the following example, taken from https://github.com/tidyverse/readxl/issues/53. readr::read_csv("x,x,y\n1,2,3\n") #>…
Rob Creel
  • 323
  • 1
  • 8
4
votes
2 answers

Don't skip empty leading rows when using readxl

Read_excel() function automatically skips leading empty rows. Is there a way to avoid this as I need the row.names in R to correspond with row numbers in excel? It is impossible to satisfy this objective when I am unaware how many leading rows were…
Eric Pios
  • 73
  • 1
  • 4
4
votes
1 answer

Dealing with xlsm with R

I am trying to deal with an official .xlsm file provided officially by a earthquake research center. You can download the file from theXLSM. What I am trying to do is to code R that change specific parts of the xlsm and then re-evaluate the .xlsm…
olk
  • 61
  • 1
  • 5
4
votes
0 answers

readxl fails to read all columns of excel 1997-2003 workbook

I am trying to read all EU weekly oil bulletin data files from this source http://ec.europa.eu/energy/observatory/reports, specifically all xls-files with "raw_data" in the file name. library(rvest) library(readxl) library(tidyverse) url <-…
GypsyEyes
  • 41
  • 2
4
votes
2 answers

Error when using readxl: 'exdir' does not exist

I am trying to use readxl::read_excel to import tabular data from an excel spreadsheet (.xlsx and .xls) into R. I have had success with this function when reading spreadsheets from Desktop, but I am having trouble reading from my Documents folder…
georgemirandajr
  • 105
  • 1
  • 1
  • 7
4
votes
1 answer

Use regular expression in sheet names of excel

I have over 100 excel files, each with 50 sheets. I am trying to read one sheet from each file. The location and name of the sheet that I am trying to read varies in each file. However, the name of sheet (that I am trying to read) in each file…
user227710
  • 3,164
  • 18
  • 35
4
votes
2 answers

read_excel () and lapply()

I have a .xlsx file has two sheets and I want to generate a list of both excel sheets using read_excel from readxl package . I have used this code my_work <- lapply(excel_sheets("data.xlsx"), read_excel, …
Bahgat Nassour
  • 157
  • 4
  • 14
4
votes
0 answers

Read multiple excel spreadsheets into R using readxl and correct variable types

I have several excel files that I am trying to read into R using the package readxl. The excel files consist of several tabs each of 60000 rows having four columns of variables. The first column is a simple integer count to track seconds from 0,…
3
votes
2 answers

R Markdown struggling with read_xlsx, Warning: Expecting logical

When running read_xlsx() in my normal .R script, I'm able to read in the data. But when running the .R script with source() in R Markdown, it suddenly takes a long time (> 20+++ mins I always terminate before the end) and I keep getting these…
A. Piong
  • 192
  • 1
  • 11
1
2
3
23 24