Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 09:47 PM
Hi KSB
You could read direkt with Databricks from Excel Sharepoint with Graph API. Here is one possible way: https://community.databricks.com/t5/data-engineering/load-data-from-sharepoint-site-to-delta-table-i...
However, you need the proper rights/grants to use the Graph API.
Another approach: Copy the Excel from Sharepoint to your Datalake with Power Automate. Then, read the data with Databricks into a Delta Table. If you have your Excel file in the data lake, the code could look like this:
pip install openpyxl
import pandas as pd
schema_name = f"my_catalog.my_schema"
file_location_xls = "/Volumes/demo_shared/samples/files/FinancialsSampleData.xlsx"
# create pandas dataframe
pdf = pd.read_excel(file_location_xls, sheet_name="Financials1")
# convert pandas dataframe to pyspark dataframe
df = spark.createDataFrame(pdf)
df.write.saveAsTable(f"{schema_name}.financials_sheet1")