# CSV iterator does not seem to work with CR (vs CRLF) at end of each line

**URL:** <https://www.finalbuilder.com/forums/t/csv-iterator-does-not-seem-to-work-with-cr-vs-crlf-at-end-of-each-line/6846>\
**Category:** Bugs\
**Created:** [September 8, 2020, 3:20pm UTC](https://www.finalbuilder.com/forums/t/csv-iterator-does-not-seem-to-work-with-cr-vs-crlf-at-end-of-each-line/6846 "2020-09-08T15:20:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanmeltzer](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jonathanmeltzer](https://www.finalbuilder.com/forums/u/jonathanmeltzer)\
**Post date:** [September 8, 2020, 3:20pm UTC](https://www.finalbuilder.com/forums/t/csv-iterator-does-not-seem-to-work-with-cr-vs-crlf-at-end-of-each-line/6846/1 "2020-09-08T15:20:04Z")

</div>

I have a data file that I receive each week and process with Automise using the CSV iterator. The week of 8/27 (and all previous weeks), the file was processed fine. On 9/3 I received the same file (as far as I could tell), but the CSV iterator indicated that there was only one line in the file and only processed the first line. I tried saving the file with another filename (still as a CSV), but it did not solve anything. Then, in Notepad++, I viewed both files while showing ALL characters, and it indicates that the new file has a CR (carriage return) at the end of each line, while the old file (which processes correctly) has a CRLF (carriage return and line feed) at the end of each line. This seems to be the only difference.

I am not sure how the file is being processed differently, but is there a way for Automise to work correctly with just the CR at the end of each line?

I cannot provide the files themselves, but if you are unable to replicate this issue I can try to create mockups and send those.

Thanks,

Jonathan

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [September 9, 2020, 12:06am UTC](https://www.finalbuilder.com/forums/t/csv-iterator-does-not-seem-to-work-with-cr-vs-crlf-at-end-of-each-line/6846/2 "2020-09-09T00:06:28Z")

</div>

Hi Jonathon

I had a look at the code, it’s using the Scripting.FileSystemObject ReadLine function, which does not handle CR line endings. This action is going to need a rewrite to fix this.

CR only line endings are unusual, I think it’s only old mac’s that do this, most unix based OS’s (like linux and OSX) use LF, windows use CRLF.

So I guess the simplest option right now is to replace the CR with CRLF. I have attached a project that shows how to do that (replace CR with CRLF where CR is not followed by a LF).

[FixLineEndings.atp5](https://www.finalbuilder.com/forums/uploads/short-url/sG7WKjySzDlTfmChfTdS1IwGDQE.atp5) (1023 Bytes)

---

<div class="post-metadata">

**Author:** ![jonathanmeltzer](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jonathanmeltzer](https://www.finalbuilder.com/forums/u/jonathanmeltzer)\
**Post date:** [September 9, 2020, 4:13pm UTC](https://www.finalbuilder.com/forums/t/csv-iterator-does-not-seem-to-work-with-cr-vs-crlf-at-end-of-each-line/6846/3 "2020-09-09T16:13:51Z")

</div>

I appreciate the answer. This turns out to be an error on the part of the person who saved the file, but this will be a good way to (hopefully) run the batch process anyway, even when they mess up. 🙂
