Fundamentals 4 min read

How to Fix Chinese Garbled Text in CSV Files When Opening in Excel with Python

This article explains why Chinese characters become garbled when a CSV file is opened in Excel and provides a simple Python solution—using the UTF‑8‑SIG encoding—to ensure the text displays correctly, along with additional tips for handling CSV data.

Python Crawling & Data Mining
Python Crawling & Data Mining
Python Crawling & Data Mining
How to Fix Chinese Garbled Text in CSV Files When Opening in Excel with Python

Introduction

The author, a Python enthusiast, shares a common issue where Chinese characters appear as garbled text when a CSV file is opened in Excel, a problem often encountered by beginners in web scraping and data processing.

Problem Description

A fan posted a screenshot showing the garbled characters in Excel after opening a CSV file generated by Python. The issue is similar to other encoding problems discussed in previous articles about Unicode errors.

Solution

The recommended fix is to change the file encoding when writing the CSV file in Python:

encoding="utf-8-sig"

Using this encoding eliminates the Chinese garbled text, allowing the CSV to be opened in Excel correctly and enabling further data processing or conversion to standard Excel files.

Conclusion

The author summarizes that three methods were presented to solve the CSV garbled text issue, encourages readers to share other solutions, and thanks contributors for their input.

encodingCSVExceldata-processing
Python Crawling & Data Mining
Written by

Python Crawling & Data Mining

Life's short, I code in Python. This channel shares Python web crawling, data mining, analysis, processing, visualization, automated testing, DevOps, big data, AI, cloud computing, machine learning tools, resources, news, technical articles, tutorial videos and learning materials. Join us!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.