readExcel

fun DataFrame.Companion.readExcel(url: URL, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(file: File, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(path: Path, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(fileOrUrl: String, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(inputStream: InputStream, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame

Reads an Excel sheet to DataFrame.

Note that if input dataframe contains duplicate column names, they will be automatically renamed in the resulting DataFrame.

When packaging an application as a fat JAR, merge META-INF/services resources so Apache POI can discover all Excel format providers. See Packaging into a fat JAR on the documentation website.

Parameters

sheetName

sheet to read. By default, the first sheet in the document

columns

comma separated list of Excel column letters and column ranges (e.g. “A:E” or “A,C,E:F”)

stringColumns

range of columns to read as String regardless of a cell type. For example, by default numeric cell with value "3" will be parsed as Double with value being 3.0. With this option, it will be simply "3"

skipRows

number of rows before header

rowsCount

number of rows to read.

firstRowIsHeader

when set to true, it will take the first row (after skipRows) as the header. when set to false, it operates as NameRepairStrategy.MAKE_UNIQUE, ensuring unique column names will make the columns be named according to excel columns, like "A", "B", "C" etc. for unstructured data.

parseEmptyAsNull

when set to true, empty strings in cells are parsed as null (default true). These cells are ignored when inferring the column’s type.


fun DataFrame.Companion.readExcel(wb: Workbook, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, formattingOptions: FormattingOptions? = null, rowsCount: Int? = null, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame

Reads an Excel sheet to DataFrame.

Note that if input dataframe contains duplicate column names, they will be automatically renamed in the resulting DataFrame.

Parameters

sheetName

sheet to read. By default, the first sheet in the document

columns

comma separated list of Excel column letters and column ranges (e.g. “A:E” or “A,C,E:F”)

formattingOptions

range of columns to read as String regardless of a cell type. For example, by default numeric cell with value "3" will be parsed as Double with value being 3.0. With this option, it will be simply "3" See also FormattingOptions.formatter and DataFormatter.formatCellValue.

skipRows

number of rows before header

rowsCount

number of rows to read.

firstRowIsHeader

when set to true, it will take the first row (after skipRows) as the header. when set to false, it operates as NameRepairStrategy.MAKE_UNIQUE, ensuring unique column names will make the columns be named according to excel columns, like "A", "B", "C" etc. for unstructured data.

parseEmptyAsNull

when set to true, empty strings in cells are parsed as null (default true). These cells are ignored when inferring the column’s type.


fun DataFrame.Companion.readExcel(sheet: Sheet, columns: String? = null, formattingOptions: FormattingOptions? = null, skipRows: Int = 0, rowsCount: Int? = null, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame

Reads an Excel sheet to DataFrame.

Note that if input dataframe contains duplicate column names, they will be automatically renamed in the resulting DataFrame.

Parameters

sheet

sheet to read.

columns

comma separated list of Excel column letters and column ranges (e.g. “A:E” or “A,C,E:F”)

formattingOptions

range of columns to read as String regardless of a cell's type. For example, by default numeric cell with value "3" will be parsed as Double with value being 3.0. With this option, it will be simply "3" See also FormattingOptions.formatter and DataFormatter.formatCellValue.

skipRows

number of rows before header

rowsCount

number of rows to read.

firstRowIsHeader

when set to true, it will take the first row (after skipRows) as the header. when set to false, it operates as NameRepairStrategy.MAKE_UNIQUE, ensuring unique column names will make the columns be named according to excel columns, like "A", "B", "C" etc. for unstructured data.


fun DataFrame.Companion.readExcel(url: URL, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(file: File, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(path: Path, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(fileOrUrl: String, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(inputStream: InputStream, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, stringColumns: StringColumns? = null, rowsCount: Int? = null, nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(wb: Workbook, sheetName: String? = null, skipRows: Int = 0, columns: String? = null, formattingOptions: FormattingOptions? = null, rowsCount: Int? = null, nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame
fun DataFrame.Companion.readExcel(sheet: Sheet, columns: String? = null, formattingOptions: FormattingOptions? = null, skipRows: Int = 0, rowsCount: Int? = null, nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE, firstRowIsHeader: Boolean = true, parseEmptyAsNull: Boolean = true): AnyFrame

Deprecated

NameRepairStrategy is deprecated. Name repair is now always applied via ColumnNameGenerator, consistent with other IO readers. Will be ERROR in 1.1.