It seems there is no easy solution. So, below is a little function to open a dataframe in Excel. It's probably not production quality code, but it works for me!
def open_in_excel(df, index=True, excel_path="excel.exe", tmp_path='.'):
"""Open dataframe df in excel.
excel_path - path to your copy of excel
index=True - export the index of the dataframe as the first columns
tmp_path - directory to save the file in
This creates a temporary file name, exports the dataframe to a csv of that file name,
and then tells excel to open the file (in read only mode). (It uses df.to_csv instead
of to_excel because if you don't have excel, you still get the csv.)
Note - this does NOT delete the file when you exit.
"""
f=tempfile.NamedTemporaryFile(delete=False, dir=tmp_path, suffix='.csv', prefix='tmp_')
tmp_name=f.name
f.close()
df.to_csv(tmp_name, index=index)
cmd=[excel_path, '/r', '/e', tmp_name]
try:
ret_val=subprocess.Popen(cmd).pid
except:
print "open_in_excel(): failed to open excel"
print "filename = ", tmp_name
print "command line = ", cmd
print "Unexpected error:", sys.exc_info()[0]
return