您可以在下面找到我迄今为止尝试过的内容:
import pandas
from openpyxl import load_workbook
book = load_workbook('C:/Users/Abhijeet/Downloads/New Project/Masterfil.xlsx')
writer = pandas.ExcelWriter('C:/Users/Abhijeet/Downloads/New Project/Masterfiles.xlsx', engine='openpyxl',mode='a',if_sheet_exists='replace')
df.to_excel(writer,'b2b')
writer.save()
writer.close()
生成样本数据
此代码将添加两列Col1和Col2,并将数据添加到sample.xlsx的Sheet1中
将数据附加到现有excel的步骤
此代码将在excel的末尾追加数据
检查一下这些
how to append data using openpyxl python to excel file from a specified row?
假设您有excel文件abc.xlsx。 您有一个数据帧要附加为“df1”
1.使用熊猫读取文件
2.连接两个数据帧并写入“abc.xlsx”
相关问题 更多 >
编程相关推荐