I'm working to automate company data to store in ms excel. I'm storing data using pandas dataframe.
df = pd.concat([df, pd.DataFrame.from_records([{ 'Numplate': Numplate,
'CNIC': CNIC,
'Random':Random}])],ignore_index = True)
writer = pd.ExcelWriter('demo.xlsx', engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1')
writer.save()
I lock ms excel using this code
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.DisplayAlerts = False
wb = excel.Workbooks.Open("C:\yolo4FYP\demo.xlsx")
wb.SaveAs("C:\yolo4FYP\demo.xlsx", 51, 'test')
wb.Close()
excel.Application.Quit()
Password is setting and there is no error but How to open protected file to append more info in demo.xlsx . I checked all stack solution but not working for my problem