Python export to Excel file issues

55 views Asked by At

I'm using an API to pull data from a website and then save it as an excel file on my computer using Python. I then use another software (Eviews) to analyze the data in the newly generated Excel file. When I try to access the excel file using Eviews, I get an error:

"File 'C:\Users\OLEVIA~1.SHA\AppData\ev_temp\evxlsx1\xl//xl
/worksheets/sheet1.xml' does not exist in "IMPORT R:\FORECASTING\CHR\DATA\MORTGAGERATES_TEST.XLSX
 @FREQ M 1971:4" on line 10".

When I go into the file using excel and save it (without changing anything at all), Eviews is then able to see that it exists, so I know it isn't necessarily an issue on the Eviews side, but rather the way Python is saving the file to my computer. Currently this is the code I'm using:

os.chdir('R:\Forecasting\CHR\Data')
IRFHLMCFM_IUSA.to_excel("MortgageRates_TEST.xlsx", sheet_name='30YrMrtgRt', index=False)

Is there another way to save the dataframe to my computer as an excel file that I could try?

1

There are 1 answers

1
Ali Mohammadnia On

Did you activate your venv, and install the required package

And the other reason could be that your folder is a simple forlder which it has to be a python package which is contained init.py file as a way that python can import other files into eachother