Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 11:13 PM
Below code can be used
import org.apache.spark.sql.DataFrame
// Define the file path (modify this to your actual file path)
val filePath = "/dbfs/FileStore/tables/Airline.xlsx"
// Read the Excel file into a DataFrame
val df: DataFrame = spark.read
.format("com.crealytics.spark.excel")
.option("sheetName", "Sheet1") // Specify the sheet name if needed
.option("header", "true") // If the first row contains column names
.load(filePath)
// Show the DataFrame to verify the data
df.show()