Split an Excel file into multiple excel Files

Hi, I would like to get help because i’m stuck from yesterday on this.

I’ve tried multiple things but can’t go through.

I explain my case :

  • I have an Excel file (it can be CSV too), containing 105 lines, I need to split this file in few excel files with 20 lines inside for each (and so 5 lines for the last one), so it will be 6 files in total.

  • First remove all the lines after the index 20 of the first file, and split theses lines into others files of 20 lines each.

How can I go through ?

Thanks a lot

  1. Read the whole Excel file and store it in a Data row.
  2. Initiate the counter with 6
  3. iterate the data row until the counter is reached > store the value in the collections while iteration. > after getting values in to collection , Increase the counter by 6 > come out of the loop > write the collections in to a file.
  4. Iterate the row again from the item 7 > do the same process until it reaches the end of file.

Hope it helps…

1 Like

Hi, thanks for your quick reply. This could be a solution but it’s a business process that could have files that contains more or less then 105 lines (this was just an example)

Do you have any another ideas ?

This will go on with any number of lines. if you decide to keep 20 lines in number, increase the counter by 20, Make it configurable at your wish :slight_smile:

Ok understand, will try that on Monday ! Thanks for helping

If someone have any other ideas to do this, I’ll enjoy to hear from you too!

Sure! Have a great weekend… :v:

1 Like

do you have the solution for this?

do you have the solution for the method that you suggested?