Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading Excel file with utf-8 python

Tags:

python

pandas

I want to open and read an excel file with pd.read_excel using utf-8 (so other languages could be read) as in read_csv the encodings can be set to utf-8, is it possible somehow?

like image 972
Bar Kadosh Avatar asked Nov 21 '25 19:11

Bar Kadosh


1 Answers

You may pass an open file:

with open("file_path", encoding="utf-8") as f:
    pd.read_excel(f)

I didn't find a reference in the docs but a quick look in pandas code suggests "utf-8" might be the default already.

like image 188
Jérôme Avatar answered Nov 23 '25 07:11

Jérôme



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!