Python Forum

Full Version: Opening Excel
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am generating a excel file with phyton. At the end I am saving the file but I would like it to also pup open in my face.

Does anyone know how to do it?

The code I am using is:

import os
import sys
sys.path.append(os.getcwd())
import pandas as pd
import numpy as np 
.
.
.
writer = pd.ExcelWriter('Test.xlsx', engine='xlsxwriter')
.
.
.
df.to_excel(writer, sheet_name=sheetname)
workbook  = writer.book
worksheet = writer.sheets[sheetname]
.
.
.
writer.save()


Thanks in advance
Are you working under Windows?

You can try os.startfile('Test.xlsx').