Export EViews Table Object to Excel

For making suggestions and/or requests for new features you'd like added to EViews.

Moderators: EViews Gareth, EViews Moderator

mmiller2
Posts: 44
Joined: Tue Aug 23, 2016 9:56 am

Export EViews Table Object to Excel

Postby mmiller2 » Tue Feb 14, 2017 6:11 am

I would like to be able to export an EViews Table object to Excel and retain the original formatting and data. Also, it would be great if multiple tables in a single workfile page could be exported as separate worksheets in a single workbook. Are there any plans to include this in a future EViews release?

I could probably implement a not-so-elegant version using EViews user objects and an open source Excel API like Apache POI (https://poi.apache.org/spreadsheet/index.html), but was hoping to avoid doing so. It seems like it would be straightforward for you since you already export table objects to other file formats.

EViews Steve
EViews Developer
Posts: 788
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Export EViews Table Object to Excel

Postby EViews Steve » Tue Feb 14, 2017 1:13 pm

This isn't automated, but you can export the table to an RTF:

[tablename].save(t=rtf) "output file path"

Then open the file in Word. Once open, copy the entire table to the clipboard, then go to your Excel spreadsheet and Paste. Worked for me.

mmiller2
Posts: 44
Joined: Tue Aug 23, 2016 9:56 am

Re: Export EViews Table Object to Excel

Postby mmiller2 » Wed Feb 15, 2017 7:40 am

Thanks, EViews Steve. That kind of works for me, but I lose much of the formatting (like column widths and indentation) after the paste into Excel. Also, the whole point of using EViews table objects is to avoid having to cut-and-paste into Excel and the "fix" the formatting. That of course is both error prone and time consuming. Even if you could just provide accessor procs to all of the attributes (i.e., width, font, indent, etc.) for each cell in the finished table, it would be easy to iterate cell-by-cell and make an Excel version using an API.

EViews Steve
EViews Developer
Posts: 788
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Export EViews Table Object to Excel

Postby EViews Steve » Wed Feb 15, 2017 8:15 am

I agree it would be nice to have an Excel output format for tables - but to keep all the formatting the same we'd have to understand how all of that formatting is stored in an Excel layout and recreate it correctly. And even then there would probably still be issues with fonts, column widths not being exact, and then the problem with Excel changing the formatting of numbers after the spreadsheet gets loaded, etc. Not impossible, but not easy either.

Have you tried our OLE object support yet? If you want to keep the table layout formatting exactly the same, you could copy the EViews table into the clipboard, then switch to Excel and then right-click a cell and select Paste Special, then select either the "EViews Object" or "Picture (Enhanced Metafile)". This preserves the look of the table - though the individual values will not be editable. If you want to keep the values editable, re-do the Paste Special, but this time select the "Paste as link" option, then select the "EViews Object". This still preserves the formatting but now you can double-click the table in Excel to re-open it in EViews so you can edit the values. This is part of our OLE object support in EViews 9.

Steve


Return to “Suggestions and Requests”

Who is online

Users browsing this forum: No registered users and 8 guests