'in a temp workfile, load the source text into a table object
create u 1
'importtbl(type=text, name=tt) source.txt "ftype=ascii,rectype=crlf,fieldtype=delim,delim=|"
importtbl(type=excelxml, name=tt) prob.xlsx

'now loop thru rows 1 to 3 and replace any empty columns with last non-blank column value
for !r = 1 to 3
	%last=""
	for !c = 1 to tt.@cols
		%current = @trim(tt(!r,!c))
		if %current="" then
			tt(!r,!c) = %last 'update empty header cell with last available value
		else
			%last = %current
		endif
	next
next

'now save the newly modified text file (now delimited with commas)
tt.save(t=csv) modified.csv
wfclose 'close our temp workfile

'now import the csv file into a new workfile
wfopen(type=txt) modified.csv "ftype=ascii,rectype=crlf,fieldtype=delimited,delim=comma,colhead=3,namepos=all"


