Shuffle rows - CSV to Excel - Using datatable


When I try to convert a CSV to excel file using datatable approach, is it possible the rows might be shuffled? And even my headers are only appearing at the bottom? Is there any reason to this?

What I did - Steps

  1. Read csv to read the csv file
  2. store the output in datatable dt1
  3. use excel application scope
  4. write range to write the output to a new excel sheet

However when I see the output excel, data is generated but in random order. Is it possible? Moreover my headers are displayed as a last row. Why do you think this is happening?

Hi @Selvasathappan, why not use read excel to read your excel file at the first step?


Sorry, I am using read csv to read csv file in the first step

hi @Selvasathappan, it should be the same sequence as your csv. May I get a screenshot of your csv file?

Hello Quihan,

Thanks for the response. However before I could try the earlier issue, I had to work on other task. Can you please help me with the below task? I am struggling to get this right with limited knowledge in .net

Hi @Selvasathappan, I think there are some suggested solutions at your previous post.
Cheers :slight_smile:

@quihan - Hello quihan, can you help me with this?

@quihan - Can you please help me with this?