Page 1 of 1

Importing Excel spreadsheet from the Web

Posted: Mon Jun 05, 2017 8:51 pm
by macgibbonn
I have a program that is trying to import a spreadsheet from a webpage, but I am getting an error (screenshot of the error dialog attached) saying:
File 'C:\Users\MACGIB~1\AppData\ev_temp\hc5.xls' does not match expected format in "IMPORT HTTP://WWW.RBNZ.GOVT.NZ/-/MEDIA/RESERVE ... C5/HC5.XLS RANGE=B5:S450 COLHEAD=1 @FREQ M 1990M12".
The code I am using is:

Code: Select all

pagecreate m 1950m1 2025m6 pagerename untitled monthly '#### This import statement from the web works fine ###### import http://www.rbnz.govt.nz/-/media/ReserveBank/Files/Statistics/tables/s33/hS33.xls range=Data!b5:ak450 colhead=1 @freq m 2016m12 ''#### This import statement from the web fails ####### import http://www.rbnz.govt.nz/-/media/ReserveBank/Files/Statistics/tables/c5/hc5.xls range=Data!b5:s450 colhead=1 @freq m 1990m12 ''##### But this import statement works on the file downloaded to my local network ######## import M:\hc5.xls range=Data!b5:s450 colhead=1 @freq m 1990m12
I am confused as to how I can import the file into Eviews from my local network, but not directly from the web.

Any suggestions?

Re: Importing Excel spreadsheet from the Web

Posted: Mon Jun 05, 2017 9:21 pm
by EViews Gareth
The Excel file format is slightly incorrect. Doesn't matter whether you open it from the web, or from a local copy.

Excel is able to open the file (and then save in a correct format).

Re: Importing Excel spreadsheet from the Web

Posted: Tue Jun 06, 2017 8:26 pm
by macgibbonn
Gareth,

Are you able to provide any further detail about what exactly was incorrect about the format of the Excel file?

It would be nice to be able to let the organisation whose file it is know the details.

Cheers
Nairn

Re: Importing Excel spreadsheet from the Web

Posted: Wed Jun 07, 2017 10:15 am
by EViews Jason
I didn't narrow it down to which record (I think it is the first one), but one of the records in the file has a length of 16608. According the the XLS binary format specification records are not to exceed 8224.

See https://msdn.microsoft.com/en-us/librar ... e.14).aspx. The 'Key Components of the MS-XLS File Format' section reads:
A record cannot exceed 8224 bytes. If the data the record applies to is larger than that, the rest is stored in one or more continue records.

Re: Importing Excel spreadsheet from the Web

Posted: Tue Feb 02, 2021 11:23 am
by startz
If you can open it in Excel, open it there and save it under a new name. Good chance EViews will be able to read in the saved version.