On Fri, 9 Aug 2013, Logan Kelly wrote:
OK. open does not work in a function, so I did not think to
try append.
So here is my test:
set echo off
set messages off
set skip_missing off
I don't think you want/need "skip_missing off" there, that's
just for matrices.
clear
string datafile ="@workdir\EMU_RAW"
open "(a)datafile.xlsx" --preserve --sheet=1 --coloffset=0 --rowoffset=1
function void opendata(string file, string cc)
append "(a)file.xlsx" --time-series --sheet="@cc" --coloffset=0
--rowoffset=1 --quiet
end function
Do you want the --time-series option there? That's just for
panel data.
opendata(datafile, "BD")
This causes Gretl to crash, i.e. Windows error box saying
Gretl32 has stopped working. I am using Win8 64 bit Gretl
CVS (2013-07-21).
At what point does the crash occur? I'm trying a a version of
this on Linux using dummy data and it's working OK. The xlsx
file is attached and the script is below. (BTW, I'm keeping
the 64-bit Windows build up to date with CVS, so the file now
under windows-testing is today's CVS, which includes a little
fix in regard to dates in xlsx files.)
<hansl>
function series opendata (string fname, string cc)
append "@fname" --sheet="@cc" --rowoffset=1
string retv = varname($nvars - 1)
return @retv
end function
set echo off
set messages off
string datafile = "(a)workdir/test-append.xlsx"
open "@datafile" --preserve --sheet=1 --rowoffset=1
print -o
series x2 = opendata(datafile, "BD")
print -o
</hansl>
Allin Cottrell