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
5 answers

Read open excel file in R

is there a way to read an open excel file into R? When an excel file is open in Excel, Excel puts a lock on the file, such as the reading method in R cannot access the file. Can you circumvent this lock? Thanks Edit: this occurs under windows with…
c0bra
  • 1,031
  • 5
  • 22
2
votes
0 answers

How to append a single cell from excel as a column in R

I am trying to combine multiple excel files in the same folder that all have the same layout. I have successfully pulled all the data from A13:M28 and have been able to append the rows to one big excel. But this file is unusable for me because it…
2
votes
0 answers

Export multiple workbook from R

Using below image to showcase what I am trying to do. So basically I have 2 workbook with 2 sheets at a location. I want to read them in R & perform two operation (Change 0 to NA & get average of each column) then export them back in the same manner…
Vaibhav Singh
  • 1,159
  • 1
  • 10
  • 25
2
votes
1 answer

read xlsx in R with one column about Time. How to delete the date R added additionally?

I have one excel table and would like to use read_xlsx to convert it as an R dataframe. Originally, in excel, the data looks like this: dep_time 15:37:48 04:05:14 However, after I use the read_xlsx, the time column is something like…
Jingjun
  • 177
  • 7
2
votes
0 answers

Pass parameter skip=1 in readxl::read_excel() leads to last empty column missing

Given a sample excel file from this link, I attempted to use readxl::read_excel to read files while skipping headers and renaming with new names. The code below works just fine for Sheet2 with no empty columns inside. xlsx_file <-…
ah bon
  • 9,293
  • 12
  • 65
  • 148
2
votes
1 answer

R - for view_html() how can I change the limit to more than 100

I am trying to compare two data sets df1 and df2, both having 1000 rows and 161 columns which I have loaded from Excel. When I use compare_df(df1, df2) and then try to view the HTML output by view_html(compare_df(df1, df2)) to see the difference, I…
kaydee
  • 67
  • 5
2
votes
4 answers

Remove automatically all spaces from column names using read_excel

The column names in my .xlsx Excel sheet have spaces. How can I automatically replace the spaces with "_" or "."? I would like to use read_excel because I need to specify a range in my excel sheet.
nohomejerome
  • 141
  • 1
  • 5
2
votes
1 answer

Why is read_excel very slow while the excel file to read from R is also opened in the Excel?

The environment is: R: 3.6.1 readxl version: ‘1.3.1’ When I close the Excel program, read_excel takes a second or 2, but when I have the file opened in Excel, then read_excel in R can take a few minutes. I wonder why was that?
HC_2016
  • 67
  • 1
  • 8
2
votes
2 answers

Reading from Sharepoint to R keeps throwing 403 Forbidden

I've tried all the different ways I could find on Stack Overflow but they all throw 403 Forbidden error. Some of the codes I've tried: library(RCurl) webpage <-…
DJL
  • 144
  • 1
  • 12
2
votes
0 answers

readxl or tidyxl: Prevent date coersion when reading from Excel xlsx

Is there any way to prevent coercion of dates when reading data from Excel? I'm using either the readxl package or the tidyxl package. The tidyxl package is terrific, but it automatically moves the data into the date column. Also, I was intrigued…
hackR
  • 1,459
  • 17
  • 26
2
votes
0 answers

read_excel() reading numeric type column as date type unless it's specified in col_types

I have a table in Excel with numeric, date, and character type columns. I use the read_excel() function from readxl library to load data into R. For most of the columns, read_excel by default does a good job in recognizing the column type. Problem:…
JohnR
  • 57
  • 7
2
votes
1 answer

How to specify a column as.factor with read.excel() in R?

I am trying to read a dataframe from an Excel file using the read_excel() function from the Tidyverse (ReadXl) package in R. I would like to read a column as.factor, however, the col_types argument in the read_excel() function does not seem to…
user213544
  • 2,046
  • 3
  • 22
  • 52
2
votes
1 answer

Read in Multiple Excel Files with Different Layouts in R

I have a collection of a dozen excel files I am reading in to a list of dataframes in R with the following code: data_path <- "path" files <- dir(data_path, pattern = "*.xlsx") data <- files %>% map(~readWorkbook(file.path(data_path, .), sheet =…
RAH
  • 395
  • 2
  • 9
2
votes
2 answers

Forwarding arguments in a function with purrr::map_df

I am trying to create a function that reads in all sheets in an excel workbook using readxl::read_excel and binds them into a single data frame, and allows me to pass through additional arguments to read_excel. I can do the first part fine, but not…
Lief Esbenshade
  • 793
  • 4
  • 13
2
votes
2 answers

R read_excel or readxl Multiple Files with Multiple Sheets - Bind

I have a directory full of .xlsx files. They all have multiple sheets. I want to extract the same sheet from all of the files and append them into a tibble. I have found numerous solutions for extracting multiple sheets from a single Excel file;…
DevGin
  • 443
  • 3
  • 12