I have an Excel file in the azure datalake ,I have read the excel file like the following
ddff=spark.read.format("com.crealytics.spark.excel")
.option("header", "true")
.option("sheetName","__all__")
.option("inferSchema","true")
.load("abfss://[email protected]/file.xlsx")
Now Iam confused how to get just the sheetnames from that Excel file,is there any direct function to do that ?
2
Answers
As per the github link for spark-excel.. the following code should work – please try it…Code directly taken from the github page.
I reproduce the same in my environment with sample data. I got this output.
Step1: Mount your storage account with Azure data bricks:
Step 2: Use
dbutils.fs.ls
to access the whole mount path:For example, This is my actual file path:
dbfs:/mnt/dem/read-employees-csv.xlsx
. I modified the file path like this/dbfs/mnt/dem/read-employees-csv.xlsx
. And also make sure to installopenpyxl
andfsspec
. Use this code to install packages :pip install openpyxl
andpip install fsspec
Code: