Skip to content

Instantly share code, notes, and snippets.

@nassimhaddad
Last active December 11, 2015 18:28
Show Gist options
  • Save nassimhaddad/4641659 to your computer and use it in GitHub Desktop.
Save nassimhaddad/4641659 to your computer and use it in GitHub Desktop.
read excel sheets
#' best package to read excel files is gdata
#' which works with both .xls and .xlsx
#' windows: follow instructions here:
#' http://cran.r-project.org/web/packages/gdata/INSTALL
library(gdata)
xlsx_file <- "myfile.xls"
sheet1 <- read.xls(xlsx_file,
sheet = "Sheet1",
stringsAsFactors = FALSE,
na.strings = "NA")
#' OR:
library(xlsx)
xlsx_file <- "myfile.xls"
text_data <- read.xlsx(xlsx_file, sheetName = "Sheet1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment