Open a Workbook with XLWINGS without making it visible Open a Workbook with XLWINGS without making it visible python python

Open a Workbook with XLWINGS without making it visible


Here is my working code fragment:

    import xlwings    excel_app = xlwings.App(visible=False)    excel_book = excel_app.books.open('PATH_TO_YOUR_XLSX_FILE')    excel_book.save()    excel_book.close()    excel_app.quit()


You can also try:

import xlwings as xwapp = xw.App(visible=False)book = xw.Book('PATH_TO_YOUR_XLSX_FILE')sheet = book.sheets('sheetname')df = sheet.range('A1:D10')book.close()app.quit()

#corrected typo


You could try 'with open', for example

with open ("write.csv", "a", newline='') as file:      fields=['score', 'name']                           writer=csv.DictWriter(file, fieldnames=fields)    writer.writerow({'score' : score, 'name' : username})with open ("write.csv", "r") as file:    sortlist=[]    reader=csv.reader(file)    for i in reader:        sortlist.append(i)