Hi Team,
I have to delete first 4 rows from CSV file
Input:
Output:
Anyone please help
Thanks
Shaik
Check the below thread.
Your regex will be changed as below:
strCSV = System.Text.RegularExpressions.Regex.Replace(strCSV,"(?<=^)(.*\n){4}","")
Hope it helps!!
When CSV File we recommend, not much to work/open/inspect this in Excel but within a mature Texteditor e.g. notepad++
When it is a CSV File, we can do cleansing on the Text File Base directly like:
String.Join(Environment.NewLine, System.IO.File.ReadLines("YourFullPathToTheCSV").Skip(4))
Hi @Parvathy
rows are deleted from 2 row not from 1 row, please check
I have to delete first 4 rows
Thanks
Shaik
How about the following expression?
System.Text.RegularExpressions.Regex.Replace(strCSV,"^(.*\n){4}","")
Regards,
Try this syntax:
strCSV = System.Text.RegularExpressions.Regex.Replace(strCSV,"(?<=^)(.*\n){4}","")
Hope it helps!!
@Yoichi Thank you it’s working fine
thanks
shaik
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.