Thank you for pointing out the Srcipting index, it is really helpful.
A further question: does the "list of the worksheet names" have to be strings? Can they be string variables?
![GroupSquareWolf_2-1667191186373.png GroupSquareWolf_2-1667191186373.png](https://community.jmp.com/t5/image/serverpage/image-id/46742i850C220719C9D9FF/image-dimensions/469x46?v=v2)
Here is an example I am struggling with:
![GroupSquareWolf_1-1667190873534.png GroupSquareWolf_1-1667190873534.png](https://community.jmp.com/t5/image/serverpage/image-id/46741iB8C22C06002B59B8/image-dimensions/159x163?v=v2)
The script below creates three datatables based on :Column 2 values, then save three separate sheets in one Excel files. I would like to name each worksheet based on :Column 2 values, but when I put GroupBy variable as the worksheet names (the red script below), it does not assign :Column 2 value to each worksheet.
dt = current datatable();
Summarize (dt, GroupBy = By (:Column 2) );
For ( i=1, i<= N items (GroupBy), i++,
dt<< select where (:Column 2 == GroupBy [i]);
dt2= dt << subset (
Selected Rows( 1 ),
Selected columns only( 0 )
);
show (dt2);
show (GroupBy[i]);
Create Excel Workbook ("$DESKTOP/Untitled1.xlsx", {dt2}, GroupBy[i]);
);
Thank you for your help!