Exporting to existing excel file
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Exporting to existing excel file
Is there a way to export data from E-views workfile to an existing excel spreadsheet?
Thanks.
Thanks.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Exporting to existing excel file
Follow us on Twitter @IHSEViews
Re: Exporting to existing excel file
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.
wfsave(type=excel, mode=update) test.xls range="Sheet1!a1" byrow @keep au_gdpr
Thanks.
-
- EViews Developer
- Posts: 799
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: Exporting to existing excel file
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
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
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?
-
- EViews Developer
- Posts: 799
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: Exporting to existing excel file
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:
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.
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
Still no luck. However, seems to work for my colleague here. Even the write function is not working for me. So strange.
-
- EViews Developer
- Posts: 799
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: Exporting to existing excel file
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.
Also make sure you are using the latest version of your EViews software.
Re: Exporting to existing excel file
Figured out what the problem was. My path was pointing to the wrong folder. Sorry for the trouble.
Re: Exporting to existing excel file
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
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
-
- EViews Developer
- Posts: 799
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: Exporting to existing excel file
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
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
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.
wfsave(type=excel, mode=update) tracking.xls range=weights!a2 @keep wt_gmfm_us_t
Thanks.
-
- EViews Developer
- Posts: 799
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: Exporting to existing excel file
Yes use @smpl to change your sample range on the save.
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
Re: Exporting to existing excel file
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.
wfsave(type=excel, mode=update) tracking.xls range=weights!a2 @keep @smpl 2014Q3 2017Q2 wt_gmfm_us_t
Thanks.
-
- EViews Developer
- Posts: 799
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: Exporting to existing excel file
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
http://www.eviews.com/help/helpintro.ht ... fsave.html
Sent from my iPhone using Tapatalk
Who is online
Users browsing this forum: No registered users and 43 guests