excel (DataStreamReader)
Loads an Excel file stream and returns the result as a DataFrame.
Syntax
excel(path, **options)
Parameters
Parameter | Type | Description |
|---|---|---|
| str | Path to the Excel dataset. |
Returns
DataFrame
Examples
Load a stream from a temporary Excel file:
Python
import tempfile
import time
with tempfile.TemporaryDirectory(prefix="excel") as d:
spark.range(10).write.mode("overwrite").excel(d)
q = spark.readStream.schema("id LONG").excel(d).writeStream.format("console").start()
time.sleep(3)
q.stop()