File: readWorkbook.Rd

package info (click to toggle)
r-cran-openxlsx 4.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,328 kB
  • sloc: cpp: 1,867; makefile: 2
file content (84 lines) | stat: -rw-r--r-- 2,652 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/readWorkbook.R
\name{readWorkbook}
\alias{readWorkbook}
\title{Read from an Excel file or Workbook object}
\usage{
readWorkbook(
  xlsxFile,
  sheet = 1,
  startRow = 1,
  colNames = TRUE,
  rowNames = FALSE,
  detectDates = FALSE,
  skipEmptyRows = TRUE,
  skipEmptyCols = TRUE,
  rows = NULL,
  cols = NULL,
  check.names = FALSE,
  sep.names = ".",
  namedRegion = NULL,
  na.strings = "NA",
  fillMergedCells = FALSE
)
}
\arguments{
\item{xlsxFile}{An xlsx file, Workbook object or URL to xlsx file.}

\item{sheet}{The name or index of the sheet to read data from.}

\item{startRow}{first row to begin looking for data.  Empty rows at the top of a file are always skipped,
regardless of the value of startRow.}

\item{colNames}{If \code{TRUE}, the first row of data will be used as column names.}

\item{rowNames}{If \code{TRUE}, first column of data will be used as row names.}

\item{detectDates}{If \code{TRUE}, attempt to recognise dates and perform conversion.}

\item{skipEmptyRows}{If \code{TRUE}, empty rows are skipped else empty rows after the first row containing data
will return a row of NAs.}

\item{skipEmptyCols}{If \code{TRUE}, empty columns are skipped.}

\item{rows}{A numeric vector specifying which rows in the Excel file to read.
If NULL, all rows are read.}

\item{cols}{A numeric vector specifying which columns in the Excel file to read.
If NULL, all columns are read.}

\item{check.names}{logical. If TRUE then the names of the variables in the data frame
are checked to ensure that they are syntactically valid variable names}

\item{sep.names}{One character which substitutes blanks in column names. By default, "."}

\item{namedRegion}{A named region in the Workbook. If not NULL startRow, rows and cols parameters are ignored.}

\item{na.strings}{A character vector of strings which are to be interpreted as NA. Blank cells will be returned as NA.}

\item{fillMergedCells}{If TRUE, the value in a merged cell is given to all cells within the merge.}
}
\value{
data.frame
}
\description{
Read data from an Excel file or Workbook object into a data.frame
}
\details{
Creates a data.frame of all data in worksheet.
}
\examples{
xlsxFile <- system.file("extdata", "readTest.xlsx", package = "openxlsx")
df1 <- readWorkbook(xlsxFile = xlsxFile, sheet = 1)

xlsxFile <- system.file("extdata", "readTest.xlsx", package = "openxlsx")
df1 <- readWorkbook(xlsxFile = xlsxFile, sheet = 1, rows = c(1, 3, 5), cols = 1:3)
}
\seealso{
\code{\link[=getNamedRegions]{getNamedRegions()}}

\code{\link[=read.xlsx]{read.xlsx()}}
}
\author{
Alexander Walker
}