import pandas as pd f = pd.ExcelFile('name.xlsx') sheet_names = f.sheet_names merge = [] io = pd.io.excel.ExcelFile('name.xlsx') # 注意,此行不要放在for循环内部,否则将会重复读取excel操作(耗时) for i in sheet_names: d =pd.read_excel(io, sheet_name=i) merge.append(d[['a']]) io.close()
data = pd.concat(merge,axis=1) # 沿X轴方向合并 data.to_csv('merge_sheet.csv')