Excel writer affecting other sheets in excel

I wanted to import a df to a sheet in excel file where I have multiple sheet including charts, pivot table, slicer. How to import data to that excel file without effecting other sheet. my code is below.

import pyodbc
import pandas as pd
from datetime import datetime
import win32com.client as win32
import openpyxl
import time
import os
import win32com.client as client
from PIL import ImageGrab
import xlwings as xw
import warnings

#read file from path
df = pd.read_csv(r'C:\Users\THL1012\Desktop\Daily Alert_Automation\Test\daily_output.csv')

#Export output to local folder
df.to_excel(r"C:\Users\THL1012\Desktop\Daily Alert_Automation\Test\daily_output.xlsx", sheet_name = 'Sheet1', index = False)

#data import to master file
book = openpyxl.load_workbook(r'C:\Users\THL1012\Desktop\Daily Alert_Automation\Test\Master_DailySales.xlsx')

df = pd.read_excel(r"C:\Users\THL1012\Desktop\Daily Alert_Automation\Test\daily_output.xlsx", sheet_name = 'Sheet1', index_col=[0,1])

with pd.ExcelWriter(r"C:\Users\THL1012\Desktop\Daily Alert_Automation\Test\Master_DailySales.xlsx", mode="w", engine="openpyxl") as writer:
    writer.book = book
    writer.sheets.update(dict((ws.title, ws) for ws in book.worksheets))
    df.to_excel(writer, sheet_name='import')

print("Data imported sucessfully")

I don’t know for sure, but on the face of this, I’d say that the issue is with the file mode. You have the file context manager as mode='w' which will create a new file or overwrite the contents of an existing file. Should that not be mode='a' so that you can append sheet_name='import'?

You really should create a SSCCE of your code, so that others can reproduce the issue with the minimum effort.

See: http://sscce.org/

Extremly sorry for replying late!! my objective to delete the old data and import new data in the excel sheet. that’s why have kept the mode=‘w’.

I didn’t get this answer in internet also. Kinldy help if anyone know the correct answer