cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to Insert from an excel row/cell level data into a databricks table

SureshRajG
New Contributor
 
1 REPLY 1

Stefan-Koch
Contributor III

Hi

You can achieve that with pandas. See the following example code:

%pip install openpyxl
import pandas as pd

file_location_xls = "path/to/excel/1.xlsx"

# read the sheet with Name Financials1" into a pandas dataframe
pdf = pd.read_excel(file_location_xls, sheet_name="Financials1")

# Transform the Pandas Dataframe to a Pyspark Dataframe
df = spark.createDataFrame(pdf)

# Save Dataframe as Unity Catalog table
df.write.saveAsTable("default.bronze.excel_data")

 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group