Hi
I want to use the list of employees you see below in excel file and create a .CSV file for each of the employees using the first and last names as you this one “First_Last.CSV” . Can anyone give me the design how to do it?
Hi
I want to use the list of employees you see below in excel file and create a .CSV file for each of the employees using the first and last names as you this one “First_Last.CSV” . Can anyone give me the design how to do it?
Hi,
There are some ways to achieve this. The following is a sample using dictionary.
dict = dt.AsEnumerable.ToDictionary(Function(r) r("First").ToString()+"_"+r("Last").ToString,Function(r) {r}.CopyToDataTable)
Sample20221117-1aL.zip (7.6 KB)
Hope this helps you.
Regards,
Create two datatables - mainDT and employeeDT. Read Range into a datatable (mainDT). For Each Row in Datatable to loop through the rows in mainDT. Inside the For Each Row you use the mainDT row data to populate employeeDT. Then use Write CSV with employeeDT and CurrentRow(“First”).ToString + “_” + CurrentRow(“Last”).ToString + “.csv” as the filename
I am able to get separate CSV files per names. But my one csv file contains all the list of others. I want in one CSV file only that person’s information, in the second person’s csv file I want second person’s information. Could you lay down the design? Thanks a in advance!!
Within the loop, before you Read Range again…
@Yoichi thanks a lot. That was super cool! Excellent Job!!
I have another question do you mind?
Hi,
No problem. However if your addition question apart from title of this topic, it’s better to create a new topic. Because another people who faces same issue can easily find it.
Regards,
Sure, no problem. I will create another one. I hope you’ll keep track of me.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.