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
1
vote
0 answers

How can I get readxl::read_xls to read the first column of this dataset correctly?

The first column is not being read correctly by readxl::read_xls: download.file("http://www.econ.upf.edu/~michael/bioenv.xls", "~/Downloads/bioenv.xls") head(readxl::read_xls("~/Downloads/bioenv.xls", col_names = c("s", "a", "b", "c", "d", "e",…
jtr13
  • 1,225
  • 11
  • 25
1
vote
1 answer

Read in Specific Tabs from Excel into R

I am trying to read a bunch of tabs from an excel file into R. The issue is that I only want some of the tabs, not all of them. When I try to select certain columns, I get an error because the tabs I do not want to read in don't contain the x1:x4…
bodega18
  • 596
  • 2
  • 13
1
vote
1 answer

Boolean is transformed to Date R

I have a big excel file (xls) with different columns. Columns that contain "Yes" or "No" are transferred to 1899-12-31 or 1900-01-01 when read in with "read_xls". In the excel file when I click on the columns they are either 0 or 1 but displayed as…
1
vote
1 answer

deleting a column while loading excel into R

I have an Excel that I need to load into R. Excel have columns for example - A,B,C,D,E I am trying to load it and arrange the excel in the below way- df1 <- read_excel("abc.xlsx") %>% arrange(A) The above code would load the excel with…
kaydee
  • 67
  • 5
1
vote
2 answers

R changing Excel Date columns Datatype to Logical during read_excel() if Date column is empty in excel

So I have 2 excels VIN1.xlsx and VIN2.xlsx that I need to compare. VIN1 excel has a dale column OUTGATE_DT which is populated for atleast 1 rows. VIN2 excel has a date column OUTGATE_DT which is completely null for all rows. when I import VIN1.xlsx…
kaydee
  • 67
  • 5
1
vote
1 answer

How to read rectangle surrounded by whitespace using readxl

I have an excel sheet with the following data which I am trying to read into r: I would like to read in the table at A3:C6. However, the dimensions of this data may change. I want to define it as the data starting at A3 in the top left, stopping at…
Nick
  • 62
  • 8
1
vote
1 answer

In R, why is there in the first row when I read in the dataframe

After reading in data from excel, I checked the first five rows of the data. I realized there is at the first row. Anyone knows why? Also, why did it read in as a "tibble"? This is the code I used to read in the data: formulary_data <-…
Jiamei
  • 405
  • 3
  • 14
1
vote
1 answer

Write single cell of Excel file from R

readxl makes reading from Excel into R easy: read_excel('test.xlsx',range = 'E2',col_names = FALSE) But the equivalent write command doesn't exist, right? write_excel('test.xlsx',range = 'E2','What I want to put in the cell',col_names = FALSE) Does…
1
vote
1 answer

How to create a list of tibbles (from xlsx files) in R without losing data?

I need to read some capricious xlsx files in R. Converting them to csv messes up the column names, so I'm forced to use an alternative. I can read my files with the library readxl and the function read_xlsx(). My idea was to loop on each file to…
1
vote
1 answer

read_excel in R results in certain floating numbers for column with mix of numeric and text values

I am reading an excel sheet into R using the readxl::read_excel function. While largely this has been a successful have been noticing an issue with certain columns. Uploaded a demo file in the File dropper link When the file is read into R using the…
user5249203
  • 4,436
  • 1
  • 19
  • 45
1
vote
1 answer

r read_xlsx() tacks cell number to the end of column names

I'm trying to import some data from Excel into R using read_xlsx(). I normally like to use janitor::clean_names() to make column names uniform and to tidy the data. This is the code I used: file_two <-…
1
vote
1 answer

R Shiny not reading file path

Consider a shiny app with the following folder structure (github here): ├── data │ └── import_finance.R │ └── data.xlsx ├── dashboard.R ├── ui_elements │ └── sidebar.R │ └── body.R The import_finance.R runs correctly when not run in the…
Phillip Black
  • 105
  • 1
  • 2
  • 10
1
vote
2 answers

How to read in excel sheets into one data frame in R and skip certain lines

I'm trying to read in an excel file with multiple sheets using R and merge them all into one data frame , tag the sheet name to one column of the dataframe. Then this time I got a problem that the excel sheets contain 1 extra row for unnecessary…
ML33M
  • 341
  • 2
  • 19
1
vote
1 answer

Importing data in R with read_excel and missing values

I am currently learning how to import excel into a data frame. I have researched and I am unable to find the answer so far. There are rows of data representing each month dating back to 2013, where there are about 150 rows per month (by locations).…
slbay
  • 51
  • 1
  • 6
1
vote
1 answer

Find cell with grepl & which

I'm trying to find a cell in a data.frame that starts with a given pattern (I need to search rows AND columns). The data.frames are coming from excel workbooks being read by readxl package. The location of the pattern varies by workbook. So in…
screechOwl
  • 27,310
  • 61
  • 158
  • 267