合併多個excel文件

import pandas as pd
import os
names=[
    pd.read_excel(name)
    for name in os.listdir('./')
    if '.xlsx' in name
        ]
df=pd.concat(names)
df.to_excel('合併結果.xlsx',index=False)

第一個報錯:
mportError: Missing required dependencies [‘numpy’] 解決辦法

pip3 uninstall  pandas
pip3 uninstall  numpy
pip3 uninstall  xlrd
pip3 install  pandas
pip3 install  numpy
pip3 install  xlrd

第二個錯誤:
Python打開excel異常: XLRDError: Unsupported format, or corrupt file: Expected BOF record

僅支持合併excel格式的文件

待續。。。合併多個文件多個sheet頁

發佈了183 篇原創文章 · 獲贊 6 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章