Fundamentals 4 min read

Add a Real‑Time Progress Bar to Your Python Excel Merge Script

This article shows how to integrate a tqdm progress bar into a Python script that reads multiple Excel files with pandas, concatenates them, and writes the combined result, providing clear code examples and screenshots of the before‑and‑after output.

Python Crawling & Data Mining
Python Crawling & Data Mining
Python Crawling & Data Mining
Add a Real‑Time Progress Bar to Your Python Excel Merge Script

1. Introduction

A member of a Python community asked how to display a progress bar while merging multiple Excel files in a script. The original code simply listed files, read each with pandas.read_excel, concatenated them, and saved the result.

import os
import pandas as pd
file_list = os.listdir(r"F:\123")
data_list = []
for file in file_list:
    data = pd.read_excel(r"F:\123\\" + file)
    data_list.append(data)
result = pd.concat(data_list)
result.to_excel(r"F:\123\合并表格.xlsx", index=False)

2. Implementation

The solution uses the tqdm library to wrap the file iterator, automatically showing a progress bar. The updated script adds the import and modifies the loop accordingly.

import os
import pandas as pd
from tqdm import tqdm
file_list = os.listdir(r"F:\123")
data_list = []
for file in tqdm(file_list):
    data = pd.read_excel(r"F:\123\\" + file)
    data_list.append(data)
result = pd.concat(data_list)
result.to_excel(r"F:\123\合并表格.xlsx", index=False)
print('全部表格合并完成')

Running the script produces the desired merged Excel file, and the console displays a progress bar indicating the processing status.

Progress bar output
Progress bar output

Fans later tweaked the script to improve its appearance, as shown in the following screenshot.

Enhanced script output
Enhanced script output

3. Conclusion

The article demonstrates a practical way to add a progress indicator to a Python data‑processing workflow using tqdm, helping users monitor long‑running tasks and improve script usability.

Pythondata processingExcelProgress Bartqdm
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.