Import excel spreadsheet to a database table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 03:42 PM
How to Import excel spreadsheet to a database table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 11:07 PM
Hi MGraham,
To import an Excel spreadsheet into a database table in Databricks, you can first upload the Excel file to DBFS (Databricks File System), then use libraries like pandas to read the Excel file (e.g., pd.read_excel("/dbfs/path/to/file.xlsx")) and convert it to a Spark DataFrame. Once in a DataFrame, you can write it to a database table using .write.format("jdbc") for external databases or .write.saveAsTable("table_name") for internal Databricks tables. Let me know if you'd like a quick code example!
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 11:41 PM
An alternative is also to store the flat file into a Volume in Unity Catalog. You can then access it in a similar way:
import pandas as pd
volume_path= "/Volumes/<catalog>/<schema>/<volume_folder>/your_file.xlsx"
pd.read_excel(volume_path, sheet_name="your_sheet")