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
2
votes
1 answer

Reshape data with multiple header rows in R

Julie Joe Measurement 1 Measurement 2 Measurement 1 Measurement 2 Part Number 1 33 32 33 31 Part Number 2 34 31 …
Display name
  • 4,153
  • 5
  • 27
  • 75
2
votes
1 answer

readxl Iterate over multiple worksheets in a workbook while passing additional arguments

Readxl provides a good solution to iterate over multiple sheets and name those sheets, which works great. https://readxl.tidyverse.org/articles/articles/readxl-workflows.html path <- readxl_example("datasets.xlsx") path %>% excel_sheets() %>% …
S3AN556
  • 79
  • 1
  • 1
  • 9
2
votes
1 answer

Import XLS, readxl / gdata bring in DF with NA

I am trying to bring this .xls file into R: https://www.reit.com/sites/default/files/returns/MonthlyHistoricalReturns.xls I've tried to bring it in directly from the url on a Windows machine. I've already run across the https versus http issues as…
2
votes
2 answers

Renaming doesn't work for column names starting with two dots

I updated my tidyverse and my read_excel() function (from readxl) has also changed. Columns without titles are are now called ..1, ..2 and so on, when they used to be called X__1, X__2. I'm trying to rename() these columns starting with two dots,…
ulima2_
  • 1,276
  • 1
  • 13
  • 23
2
votes
1 answer

Categorise coloured cells using `readxl` package

What I'm trying to do is exactly like what NSaunder's blog has done: Change a coloured cell in Excell into a category. However, I am using the readxl package whereas NSaunder's post uses the xlsx package. The xlsx package has a function called…
elliot
  • 1,844
  • 16
  • 45
2
votes
1 answer

read_excel truncates numbers in spite of setting digits option

I am trying to read an excel file into R with read_excel() function from the "readxl" package. Numbers in cells in the excel file have 3 decimal places, e.g. 0,684 1,338 74,296. In the R dataframe the same numbers are 0,684 1,34 74,3. Why did only…
lynx123
  • 23
  • 1
  • 4
2
votes
0 answers

Error read_xlsx (v1.0): Error in read_fun(path = path, sheet = sheet, limits = limits, shim = shim, : std::bad_alloc

I have Rstudio Version 1.1.447/R 3.4.4 on my Mac and have been running this code with no problems in my script: NCBI16S<-read_xlsx("accession_taxon_16s.xlsx") This is with readxl version 1.1.0. I am using R/3.4.0 within a computer cluster (UMass…
Gina
  • 71
  • 9
2
votes
1 answer

R automatically converts dates to string when importing xlsx

I have an excel file with a column of date info. These are the dates that people took a survey, and are formatted like "1/20/2017 2:22:34 PM" as downloaded from Qualtrics. But when I import this file to R using read_excel, each date automatically…
skittlebug
  • 29
  • 1
2
votes
1 answer

R: Append a worksheet to an excel workbook without reading the entire workbook

I have a 26 mb excel workbook to which I am trying to add a 42 kb worksheet. Using the openxlsx package, I have the following code: wb_object <- loadWorkbook(to_name2) addWorksheet(wb_object, "New Data") writeData(wb_object, sheet = "New Data",…
Rahul Nallappa
  • 181
  • 2
  • 9
2
votes
1 answer

Read excel data as is using readxl in R

I have to read an excel file in R. The excelfile has a column with values such as 50%,20%... and another column with dates in the format "12-December-2017" but R converts both the column datas. I am using readxl package and i specified in col_types…
Aakash
  • 79
  • 6
2
votes
0 answers

import formulas as values using readxl::read_excel

I have a .xlsx spreadsheet with 2 sheets. This is a screenshot of the first sheet: And this is a screenshot of the second sheet. Note that cell A2 is a value: And this is a screenshot of the second sheet. Note that cell A3 is a formula: I'm…
luciano
  • 13,158
  • 36
  • 90
  • 130
2
votes
2 answers

Read all worksheets (as dataframes) from multiple Excel workbooks of different structure

I understand that readxl can be used to read in multiple worksheets from a workbook. However, I am struggling to extend this and vectorise this across many workbooks with different sheet names and number of sheets and data therein. I demonstrate…
mammykins
  • 355
  • 3
  • 9
2
votes
2 answers

How to select specific column and type with readxl?

I am trying to solve a problem of importing xls data into R with readxl package. The specific xls file has 18 columns and 472 rows, first 7 rows have descriptive text that needs to be skipped. I only want to select col 1,3,6:9 out of the 18 columns…
Richard Yang
  • 53
  • 1
  • 3
2
votes
1 answer

Is there any way to assign the col_types by column names in read_excel(readxl) in R

My application is reading the xls and xlsx files using the read_excel function of the readxl package. The sequence and the exact number of columns are not known earlier while reading the xls or xlsx file. There are 15 predefined columns out of which…
Abhinandan Satpute
  • 2,558
  • 6
  • 25
  • 43
2
votes
2 answers

Import data from excel but get warning messages

I import data from excel and I have multiple excel so I read at one time. Here is my code: library(readxl) library(data.table) file.list <- dir(path = "path/", pattern='\\.xlsx', full.names = T) df.list <- lapply(file.list, read_excel) data <-…
Peter Chen
  • 1,464
  • 3
  • 21
  • 48