[英]Combine several xlsx files into one single xlsx
I want to combine several xlsx files into one.我想将几个 xlsx 文件合并为一个。 However this xlsx files have different number of lines and they have highlight cells.但是,此 xlsx 文件具有不同的行数,并且它们具有突出显示的单元格。 When I combine them into one, they appear to be next, without a row beteween the two dataframes, and they also lost the highlighted cells.当我将它们合二为一时,它们似乎是下一个,两个数据框之间没有一行,并且它们也丢失了突出显示的单元格。
Here is the code I have, so far:到目前为止,这是我拥有的代码:
writer=pd.ExcelWriter('output.xlsx')
# xlsfiles = [files_in for files_in in glob.glob('*.xlsx')]
for files_in in glob.glob('*.final_2.xlsx'):
excel_file=pd.ExcelFile(files_in)
df_excell=pd.read_excel(files_in)
df_excell.to_excel(writer,index=False)
writer.save()
Thanks!谢谢!
I would start by taking a look at a similar question a user has posted here:我将首先查看用户在此处发布的类似问题:
Python Excel template read and re-write, maintaining formulae and formatting Python Excel 模板读写,维护公式和格式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.