Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 04:12 AM
Hi @erigaud
You can use spark.read.format("com.crealytics.spark.excel") while reading excel files using autoloader and to specify format you need to provide com.crealytics.spark.excel and to specify sheet name you can provide it under options.
Please find the below example code to read load Excel files using an autoloader:
spark.read.format("com.crealytics.spark.excel") \
.option("header", "true") \
.option("dataAddress", "'Data - Current'!A1") \
.option("treatEmptyValuesAsNulls", "true") \
.option("inferSchema", "true") \
.load(location)
And you can also use pandas to read excel files:
import pandas as pd
pd.read_excel(file ,sheet_name = 0, index_col = 0)