Page 1 of 1

importtbl/importmat: bug when importing a "one-cell range" from excel

Posted: Thu Nov 09, 2017 5:47 am
by mamo
Dear Eviews team,

I use Eviews 9.5, 27 December 16 build

I found a bug when importing a range covering only one cell in an excel file into a matrix or a table.
For instance, the command

Code: Select all

importtbl(name=testtable, mode=overwrite) "MyExcelFile.xlsx" range="Sheet1!$C$9:$C$9"

imports the whole range right of and below the cell Sheet1!C9 into the table testable, whereas

Code: Select all

importmat(name=testmat, mode=overwrite) "MyExcelFile.xlsx" range="Sheet1!$C$9:$C$9"

imports all the rows below the cell Sheet1!C9 into the matrix testmat.

Same results obtain with the range specification range="Sheet1!$C$99"

Best, mamo

Re: importtbl/importmat: bug when importing a "one-cell range" from excel

Posted: Thu Nov 09, 2017 3:22 pm
by EViews Steve
Thanks for the report. I'll look into it...

Re: importtbl/importmat: bug when importing a "one-cell range" from excel

Posted: Thu Nov 09, 2017 3:47 pm
by EViews Steve
This is actually a bug with the IMPORT (which IMPORTTBL uses internally). If there are other non-blank cells around the cell you're trying to import, IMPORT treats your range as a starting point instead of a start & end point.

This might actually be a feature of IMPORT instead of a bug -- I'll have to investigate further to figure out which.

We'll try to get a fix for this for at least IMPORTTBL and IMPORTMAT soon...

Steve

Re: importtbl/importmat: bug when importing a "one-cell range" from excel

Posted: Mon Nov 13, 2017 1:32 am
by mamo
I see your point, yes, this can also be considered as a feature of the procedures importtabl or importmat.
Here a suggestion for future implementations:

Code: Select all

importmat(name=testmat, mode=overwrite) "MyExcelFile.xlsx" range="Sheet1!$C$9:$C$9"

would yield a 1x1 matrix containing only the contents of the cell $C$9, whereas

Code: Select all

importmat(name=testmat, mode=overwrite) "MyExcelFile.xlsx" range="Sheet1!$C$9"

would yield an nxn matrix made up of the contents of the largest coherent range below and to the right of the cell $C$9.

Alternatively, you may also think of introducing an option, retrieve=all/single, so that

Code: Select all

importmat(name=testmat, mode=overwrite, retrieve=single) "MyExcelFile.xlsx" range="Sheet1!$C$9"

retrieves only the contents of cell $C$9.
Best, mamo

Re: importtbl/importmat: bug when importing a "one-cell range" from excel

Posted: Thu Nov 16, 2017 5:03 pm
by EViews Steve
Ok, we changed IMPORT/WFOPEN to honor the Excel end cell specification when the end cell is the same as the first cell. This fix resolves the issue with IMPORTTBL and IMPORTMAT when trying to read in a single Excel cell.

This will be released in the next patch for EViews 10.