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
Valued Contributor II

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")

 

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now