Skip to content

Commit

Permalink
Add documentation for crealytics#196
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpade-zmi committed Jan 30, 2020
1 parent b5ad8f1 commit d069122
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.12.5
======
- Feature: Add `sheetNames' in shaded Workbook

0.12.4
======
- Bugfix: Shade xlsx-streamer. Should fix https://github.com/crealytics/spark-excel/issues/135
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,27 @@ val df = spark.read.excel(
.load("Worktime.xlsx")
```

If the sheet name is unavailable, it is possible to pass in an index:

```scala
val df = spark.read.excel(
useHeader = true,
dataAddress = "0!B3:C35"
).load("Worktime.xlsx")
```

or to read in the names dynamically:

```scala
val sheetNames = WorkbookReader( Map("path") -> "Worktime.xlsx"
, spark.sparkContext.hadoopConfiguration
).sheetNames
val df = spark.read.excel(
useHeader = true,
dataAddress = sheetNames(0)
)
```

#### Create a DataFrame from an Excel file using custom schema
```scala
import org.apache.spark.sql._
Expand Down

0 comments on commit d069122

Please sign in to comment.