I have a table that I would like to split into a specified number of output CSV files - such that each CSV file has roughly equal number of lines and none are more than a certain number of lines long. The source table itself will be of variable length, hence the number of files to write out can be variable as well.

I’ve solved this problem before when I knew that it was appropriate to write out 4 files; I used “Random Number Assigner” to help split the lines into the files. But going forward I won’t know how many files to write out so I’d like to use a loop (or loop-like structure) to accomplish this.

thank you