Reading XLSX From the Web

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

jaylamb20
Posts: 37
Joined: Mon Mar 17, 2014 10:07 am

Reading XLSX From the Web

Postby jaylamb20 » Wed Oct 21, 2015 2:27 pm

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

jaylamb20
Posts: 37
Joined: Mon Mar 17, 2014 10:07 am

Re: Reading XLSX From the Web

Postby jaylamb20 » Wed Oct 21, 2015 2:35 pm

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

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: Reading XLSX From the Web

Postby EViews Jason » Thu Oct 22, 2015 11:00 am

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.

jaylamb20
Posts: 37
Joined: Mon Mar 17, 2014 10:07 am

Re: Reading XLSX From the Web

Postby jaylamb20 » Thu Oct 22, 2015 11:15 am

Interesting. Ok, that works for me! Sorry that this turned out to not be an EViews problem.

Thanks Jason.

-James


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 1 guest