Click here to Skip to main content
15,794,593 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
i have created a project in c# to get data from an api link and load it into csv file . each time when i run the project in c# ,only 3 minutes of data iam getting into csv .so when i run it again and again next 3 min of data iam getting and otherb csv is been created in that specified file location. i need to append evry 3 min data into one csv file rather than separate files. can anyone please help me to append my every 3 min of data into one csv file when i run

What I have tried:

i have tried to get the data separately. but i need in one csv file.
Updated 30-Sep-22 1:52am
OriginalGriff 30-Sep-22 6:53am    
Downvote countered.

1 solution

Instead of opening a file and writing text, use the File.AppendText(String) Method (System.IO) | Microsoft Learn[^]
Just build your new data in a StringBuilder, and when you are ready to add convert it to a string and append it.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900