Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 09:47 PM
In general, you shouldn't use dbfs any more, instead, use Volumes.
But, as example, if I have an excel in my Worskpace directory, you could do this.
%pip install openpyxl
import pandas as pd
# replace with your path
file_path = "/Workspace/Users/stefan.koch@btelligent.com/excel/FinancialsSampleData.xlsx"
# read the sheet with Name Financials1 into a pandas dataframe
pdf = pd.read_excel(file_path, sheet_name="Financials1")
# Transform the Pandas Dataframe to a Pyspark Dataframe
df = spark.createDataFrame(pdf)
display(df)Would this work for you or what is your dbfs path?