wks.col does not refer to selected column.
You may try using wks.c1.
double freq = 32.703;
if (wks.c1==1)
{type -a "cannot set col(A)";return;}
//wks.c1 refers to leftmost selected column
wks.col$(wks.c1).lname$="C1";
//provide selected col as input
csetvalue col:=$(wks.c1) formula:="sin(2*pi*freq*col(A))" recalculate:=0;
sparklines sel:=1;