Look like the code is using a
loop to print out all the number into a cell but it should only print 1 number per cell.
statement should do it.
$ts_qty = 5
; Then replace the while loop with the following