Page 1 of 2

Exporting to existing excel file

Posted: Fri Jul 21, 2017 5:54 am
by trainee
Is there a way to export data from E-views workfile to an existing excel spreadsheet?

Thanks.

Re: Exporting to existing excel file

Posted: Fri Jul 21, 2017 6:12 am
by EViews Gareth

Re: Exporting to existing excel file

Posted: Fri Jul 21, 2017 7:30 am
by trainee
I tried the following code. It didn't populate anything.

wfsave(type=excel, mode=update) test.xls range="Sheet1!a1" byrow @keep au_gdpr

Thanks.

Re: Exporting to existing excel file

Posted: Mon Jul 24, 2017 8:56 am
by EViews Steve
Works for me...

Keep in mind that if you have the Excel file open in Excel at the time you run the WFSAVE command, EViews is forced to ask Excel to make the changes via COM since Excel has the file locked. Which means the changes are made to the open file in memory, at which point you'll have to manually save the file in Excel in order to keep the changes. If the file is not open, EViews can make the changes directly to the saved file.

Steve

Re: Exporting to existing excel file

Posted: Mon Jul 24, 2017 10:12 am
by trainee
No I don't have the file open. Also, I have a feeling that the "write" command is now obsolete. Is that true? If yes, what do you suggest we use?

Re: Exporting to existing excel file

Posted: Mon Jul 24, 2017 10:17 am
by EViews Steve
We mention on the write help page that you should use pagesave when not saving in transposed form. But WFSAVE will work just fine for that too.

If you're still having trouble, for now, just try saving your workfile page to a new excel spreadsheet file, but leave the range argument out, like this:

Code: Select all

wfsave(type=excel, mode=update) test_new.xls byrow @keep au_gdpr

and see if you can see your data. Once confirmed, manually your data in the spreadsheet to be anything else, save and close the spreadsheet, then re-run the exact same WFSAVE command to see if the spreadsheet is restored.

Re: Exporting to existing excel file

Posted: Mon Jul 24, 2017 11:52 am
by trainee
Still no luck. However, seems to work for my colleague here. Even the write function is not working for me. So strange.

Re: Exporting to existing excel file

Posted: Mon Jul 24, 2017 12:21 pm
by EViews Steve
Did the new file get created? Did it fail on the first or the second WFSAVE call? Please provide more details on what worked and what didn't.

Also make sure you are using the latest version of your EViews software.

Re: Exporting to existing excel file

Posted: Mon Jul 24, 2017 12:24 pm
by trainee
Figured out what the problem was. My path was pointing to the wrong folder. Sorry for the trouble.

Re: Exporting to existing excel file

Posted: Mon Jul 24, 2017 1:50 pm
by trainee
Another question - I'm trying to use wfsave to save data in different tabs of an excel spreadsheet. But I can't seem to do that in one go. Instead e-views will close the excel file and open it again every time which takes a lot of time. Is there a way around this? Thanks so much.

Using the following code:

for %country {%countries}

wfsave(type=excel, mode=update) test.xls range= %country!a1 byrow @keep wt_gmfm_{%country}_t wt_gmfm_{%country}_t1 wt_stem_{%country}_t wt_stem_{%country}_t1 wt_bbg_{%country}_t wt_bbg_{%country}_t gmfm_{%country}_{%c}tc gmfm_{%country}_{%e}t1c stem_{%country}_{%c}tc stem_{%country}_{%e}t1c bbg_{%country}_{%c}tc bbg_{%country}_{%e}t1c

next

Re: Exporting to existing excel file

Posted: Tue Jul 25, 2017 7:12 am
by EViews Steve
No there isn't a way to do this in one go.

You might look into using the EViews Excel adding from within Excel to import and link data from your workfile to your spreadsheet. That way you can simply ask Excel to refresh all data. It'll probably be faster that way instead of pushing data from EViews sheet by sheet.


Sent from my iPhone using Tapatalk

Re: Exporting to existing excel file

Posted: Tue Jul 25, 2017 12:13 pm
by trainee
Thanks Steve. When one uses the Wfsave function it seems to dump all values in a series. However, I only want to dump non-NA values in the series into excel. For instance, the following code would dump the entire series including all the NAs. Is there something I can do about it? May be assign a sample?

wfsave(type=excel, mode=update) tracking.xls range=weights!a2 @keep wt_gmfm_us_t

Thanks.

Re: Exporting to existing excel file

Posted: Tue Jul 25, 2017 12:30 pm
by EViews Steve
Yes use @smpl to change your sample range on the save.


Sent from my iPhone using Tapatalk

Re: Exporting to existing excel file

Posted: Tue Jul 25, 2017 12:52 pm
by trainee
Can you give me an example? I tried the following but E-views dosen't like it:

wfsave(type=excel, mode=update) tracking.xls range=weights!a2 @keep @smpl 2014Q3 2017Q2 wt_gmfm_us_t

Thanks.

Re: Exporting to existing excel file

Posted: Tue Jul 25, 2017 12:57 pm
by EViews Steve
Follow the order of the arguments as described on the WFSAVE help page.

http://www.eviews.com/help/helpintro.ht ... fsave.html


Sent from my iPhone using Tapatalk