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: 

Hi i have uploaded excel file in databricks but it shows different language.

Ziy_41
New Contributor

Hi,

I have attach one excel file in data bricks edition but unfortunately it shows a diiferent langaue in ouput whice i wrote display(df). below im attaching the screenshot please let me now thanking you in advance. 

Ziy_41_0-1729504438295.png

 

2 REPLIES 2

Panda
Valued Contributor

@Ziy_41 When loading the file, try explicitly setting the encoding

.option("encoding", "UTF-8")

 

Stefan-Koch
Valued Contributor II

CSV and Excel are not the same datatype. 

You can load the excel data into a pandas dataframe and then convert it to a pyspark dataframe.

first, you have to install the openpyxl library

 

%pip install openpyxl

 

Then import PySpark Pandas:

 

import pyspark.pandas as ps

 

 And then read the excel-data into a df:

 

path = "/Volumes/demo/raw/files/FinancialsSampleData.xlsx"

# create pandas-df
pdf_sheet1 = ps.read_excel(path, sheet_name="Financials1")

#convert pandas-df to pyspark-df
df_sheet1 = pdf_sheet1.to_spark()
display(df_sheet1)

Your df should look like this: 

df_sheet_1.png

 

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