Split excel files into multiple files

Hi all,

Scenario: Read the file and store it in data table, next take total count of rows and divide it by a number which is configurable (3,4,5,6,7…).
Next based on divided value obtained it has create multiple excel files

Eg: If total count is 31 and in config file the no provided is 5,so it has to create 5 files with count of rows in excels files as 6+6+6+6+7
Similarly if total count is 30 and in config file the no provided is 3,it has to create 3 files with count of rows in excel files as 10+10+10.
Please can of you help me out on this.

@Deeksha_Devaiah
have a look here:

Thanks Peter.
Will look into it,if any doubts on this will get back to you.

Any other solution please?

@Deeksha_Devaiah Can you tell us what kind of Solution are you looking into ?

Hi Arpan,

As per the scenario,the total count of rows will depend on the excel provided by business and I divide it by either 3,4,5 or any no which is configurable
As in solution suppose the excel count is 31 and it is divided by 5 so which will be a decimal value 6.2. So the bot has to spilt those 31 rows into 5 excels each having 6 rows and one with 7 rows …If suppose the total row count is 500 and divided value is 10 then we need to have 50 rows in each excel.so both scenarios code has to work.

Is there a way ?

@Deeksha_Devaiah Check the below workflow :
Split Excel Rows into Different Excel.zip (15.8 KB)

Check the Input Excel File. Execute the Workflow. The Output files will be generated in the Output folder.

This is a similar operation as to what is done in the above posts. But if you are not convinced with this method of execution to attain the required output then I suggest you to explain in a little more detail as to why the Solution is not the Expected one.

Also Test the Workflow with different inputs and revert back if it didn’t help.

@supermanPunch
Yea it is working fine…Please can you give a brief explanation on the code part it would be helpful,i understood but not that clear…What does that in for each loop having enumerable mean?

@Deeksha_Devaiah Check the below link for more clear explanation on the Enumerable methods :
https://www.dotnetperls.com/enumerable-range

@supermanPunch
Thanks much.

1 Like