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
Contributor III

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

 

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