0

I'm trying to write data to an excel file that is already open and saved with a specific filename. I need to do this without specifying a file path.

What I have below is not writing anything to the spreadsheet.

import pandas as pd
df = pd.DataFrame({data1, data2, data3})
writer = pd.ExcelWriter("*open_excel_filename*.xlsx")
df.to_excel(writer,"Sheet1",startrow=1,startcol=1)
Retsied
  • 79
  • 8
  • 1
    if the excel file is opened by anyone other than yourself there is no way to write to it, unless your using Excel Online/Sharepoint. Even then you'll need to use the o365 api or something like XLwings, - secondly _if_ you can't specify the path how will the program know where the excel fiel is? – Umar.H Apr 09 '21 at 17:45
  • The excel file is open by only myself. That's my question, is how do I write to an open excel file based only on filename, instead of file path? Seems like there should be a "find_open_excel_doc_by_filename" command or something – Retsied Apr 09 '21 at 17:49

0 Answers0