1

I have a csv file which may have empty or blank rows. I want to delete such rows but the problem is that the csv files can be potentially very large. So, I am looking for a way to do it without having to load it in memory.

The solution that works for me is using a DataTable or a StreamReader, but both of them will be using the memory which is not preferable.

Thanks in advance.

1
  • 1
    Using a StreamReader, you don't have to load the whole file into memory at once - you can do it line-by-line. Commented Jun 20, 2012 at 7:46

1 Answer 1

4

I don't think you can do it without loading the file.

I would use a fast CSV reader/writer from http://www.filehelpers.net - I'm sure you can link writer stream to reader stream so you write as you read and you don't need to load the whole file at once.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.