Skip to contents

Inspect Excel table column metadata in a workbook

Usage

excel_table_columns(
  file,
  table,
  columns = NULL,
  col_names = TRUE,
  header_row = NULL,
  skip_rows = NULL,
  n_max = Inf,
  schema_sample_rows = NULL,
  dtype_coercion = c("coerce", "strict"),
  dtypes = NULL,
  skip_whitespace_tail_rows = FALSE,
  whitespace_as_null = FALSE,
  available = FALSE
)

Arguments

file

Path to an Excel workbook, or a raw vector containing workbook bytes.

table

Name of the Excel table to read.

columns

Optional table columns to select, as a character vector of column names or a numeric vector of 1-based column positions.

col_names

TRUE to use the first row as names, FALSE to generate names, or a character vector of explicit names.

header_row

1-based row containing column names when col_names = TRUE. Use NULL to let the reader use its default first non-empty row behavior.

skip_rows

Number of rows to skip after the header row. Use NULL for the upstream default of skipping only empty leading rows.

n_max

Maximum number of data rows to read.

schema_sample_rows

Number of rows to sample for schema inference. Use NULL to sample all rows.

dtype_coercion

How to handle cells that do not match the inferred or specified type: "coerce" or "strict".

dtypes

Optional type override. Supply a single dtype string to apply to all selected columns, or a named character vector mapping column names to dtypes. Supported values are "null", "int", "float", "string", "boolean", "datetime", "date", and "duration".

skip_whitespace_tail_rows

Whether to ignore trailing rows containing only whitespace and null values.

whitespace_as_null

Whether string cells containing only whitespace are treated as missing values.

available

If FALSE, return metadata for the selected columns. If TRUE, return metadata for all available columns after applying header and dtype options, ignoring columns.

Value

A tibble with one row per column and columns name, index, absolute_index, dtype, column_name_from, and dtype_from. Indices are 1-based for R.