Page 1 of 2
Making Eviews open excel
Posted: Mon Sep 21, 2015 2:11 pm
by ian.e.preston
I have a program that imports data from an excel file. For some reason it will only successfully import the data if I have the excel file open prior to running the program. This is not an issue with other excel files. What I'd like to do as a hack-y solution is just call excel to open the file from my eviews program. Failing that I guess I'd like to find out why I can't pull from this particular file and fix it that way. Any tips?
Re: Making Eviews open excel
Posted: Mon Sep 21, 2015 2:30 pm
by EViews Gareth
Best thing to do would be to provide us with the Excel file so we can try and figure out why EViews cannot open it.
Re: Making Eviews open excel
Posted: Mon Sep 21, 2015 2:33 pm
by ian.e.preston
That does seem best. Here you go.
Import code is as follows:
Code: Select all
%secfrom = [path]\LTC_Sec_monthly.xlsx"
import %secfrom range=Page1_1 @id Claim @destid @date
Re: Making Eviews open excel
Posted: Mon Sep 21, 2015 5:01 pm
by EViews Jason
EViews couldn't auto detect the date series 'claim' since it is out of order. It is in alphabetic order but not time order.
I also do not notice a difference as to whether or not Excel is open or not. In both cases, the above problem exist.
With that being said, try using
Code: Select all
import ltc_sec_monthly.xlsx range=Page1_1!$A$1:$L$189 colhead=1 na="#N/A" @freq M @id @date(claim) @smpl @all
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 7:59 am
by ian.e.preston
Same issue. If I run it with the excel file closed I get this error:
Unable to determine date format of object CLAIM in [PATH] range=Page1_1!$A$1:$L$300 colhead=1 na="#N/A" @freq M @id @date(claim) @smpl @all
If I open the excel file first and then run the program it's fine.
Excel 2010 and Eviews 9 - July 23 2015 build.
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 8:15 am
by EViews Gareth
Could you try updating to the latest version of 9?
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 8:17 am
by ian.e.preston
I can't actually. IT at work has pretty strict version control. I'd have to make a whole business case etc.
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 9:04 am
by EViews Gareth
Try opening the file in Excel, saving it locally, then closing down Excel and trying to open it in EViews. Does that work?
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 9:32 am
by ian.e.preston
Saved the file to my desktop, it was on a network mapped drive before. Exact same issue.
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 9:50 am
by EViews Gareth
What happens if you try to open it interactively?
Do any of the data get read in correctly?
Our best guess is that it is an Excel security issue.
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 9:54 am
by ian.e.preston
Not sure what you mean by interactively. Can you clarify?
I'm stumped too, this file is generated by Cognos report studio, saved on a network drive. Other reports generated in the same manner saved in the same location don't have this issue. The one distinction I can think of is that the date is sorted alphabetically, as was pointed out. I don't know why having the file open in excel makes a difference for that though.
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 10:41 am
by ian.e.preston
Ok, I recoded the query so dates are in chronological order. Same error.
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 11:05 am
by EViews Gareth
If you use File-Open rather than using a command to open the file.
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 11:11 am
by ian.e.preston
I think I'm missing something here. Are we talking about the excel file or the eviews file?
Here are the combinations I can think of, and the outcomes that result from them:
Attempt to import into eviews without Excel open:
-Importing the data via script claims.prg - previously quoted error message
-From eviews opening my workfile, going to file -> import and trying to load the data - only shows claim header, no other columns for sectors and no actual data, can't import
Have Excel file open prior to importing to Eviews:
I can do this by double clicking the Excel file, or opening excel and the going to file -> open and loading the file, no difference
Both manual import and importing via script work fine
Does this help narrow it down?
Re: Making Eviews open excel
Posted: Tue Sep 22, 2015 12:09 pm
by EViews Gareth
Somewhat.
What happens if you save it as .xls rather than .xlsx?