Page 1 of 1

Reading XLSX From the Web

Posted: Wed Oct 21, 2015 2:27 pm
by jaylamb20
Hello,

I'm struggling to read data in .xlsx form from the web. I followed the Stock & Watson example for XLS on pg. 519 of the EV9 command ref, but no luck.

Here are a few variations I've tried, all with errors (including one message that read "mystery error"):

Code: Select all

%url = "http://www.policyuncertainty.com/media/Russia_Policy_Uncertainty_Data.xlsx" wfopen %url wfopen {%url} wfopen(type=excelxml) %url wfopen(type=excelxml) {%url} wfopen(type=excel) %url wfopen(type=excel) {%url}
The file is standard in that it has numerical data in columns (starting in cell A1 of the workbook's only sheet) with one header row. Downloading does not require authentication and the file is not protected/locked.

I would even be happy if I could just programmatically do a two-step process where I 1) download to the ev_temp folder and 2) read in from that location on disk. I know that this could be done with other software, but I'm trying to keep this particular project all-EViews.

Any ideas?

Running EV9 Enterprise on Windows 7.

Thanks,

-James

Re: Reading XLSX From the Web

Posted: Wed Oct 21, 2015 2:35 pm
by jaylamb20
Update:

For some reason, running the code below successfully downloads the file and leaves it in the ev_temp folder, but errors out on read:

Code: Select all

%url = "http://www.policyuncertainty.com/media/Russia_Policy_Uncertainty_Data.xlsx" wf a 1900 2050 importtbl(type=excelxml) %url
When I tried to open a workfile and manually read from that file in ev_temp (Russia_Policy_Uncertainty_Data.xlsx) using the GUI, I got the same error "File 'C:\Users\{username}\ev_temp\evxlsx\[content_types].xml' does not match expected format.'

I can manually double-click and open the file in Excel, so I know that it is not corrupted.

-James

Re: Reading XLSX From the Web

Posted: Thu Oct 22, 2015 11:00 am
by EViews Jason
The file is not a properly formatted Excel file. It probably wasn't created by Excel.

If you open the file in Excel and resave it, you can then import/open the new file.

Excel is very good reading files which do not follow the complete file specification.

Re: Reading XLSX From the Web

Posted: Thu Oct 22, 2015 11:15 am
by jaylamb20
Interesting. Ok, that works for me! Sorry that this turned out to not be an EViews problem.

Thanks Jason.

-James