I want to write a data frame into an existing Excel sheet without overwriting and save it using another file name using Python
import pandas as pd
import openpyxl
srcfile = openpyxl.load_workbook('C:\\Users\\kavitha.j\\Desktop\\Automation\\Report builder\\template.xlsx',read_only=False, keep_vba= True)*#to open the excel sheet and if it has macros*
df=pd.read_excel('C:\\Users\\kavitha.j\\Desktop\\Automation\\Report builder\\CVS Report Builder test.xlsx',sheet_name='Landing Page',skiprows=8)
df
sheetname = srcfile.get_sheet_by_name('Sheet1')#get sheetname from the file
sheetname.range('A9').value = df
sheetname.range('A9').options(pd.DataFrame, expand='table').value
srcfile.save('C:\\Users\\kavitha.j\\Desktop\\Automation\\Report builder\\finaltemplate.xlsm') #save it as a new file, the original file is untouched and here I am saving it as xlsm(m here denotes macros).