Trying to find a good way to handle these on.
My wish .:
- Delete any rows that lack information in all fields.
- Give a message if a row has the wrong number of fields.
for example 24,56 instead of "24,56" and I want to draw attention to this.)
Background .:
(A CSV-file can be from a few rows to maybe 50,000 rows)
Encode = UTF-8
csvFile = the name of the CSV-file.
If I want to read the headlines I use .:
Code: Select all
FileEncoding %vEncode% ; Encoding for FileReadLine and Loop Read
FileReadLine outLine, % csvFile, 1
Code: Select all
Loop Read, %csvFile%
{ Loop Parse, A_LoopReadLine, CSV
{
Some examples
example 1. (row 3 is empty)
example 2. (row 3 is empty)Head1,Head2,Head3
info1,info2,info3
InfoA,infoB,infoC
example 3. (row 3 is empty)Head1,Head2,Head3
info1,info2,info3
,,
InfoA,infoB,infoC
example 4. (row 3 is empty)Head1,Head2,Head3
info1,info2,info3
"","",""
InfoA,infoB,infoC
example 5. (row 1 and row 4 is empty)Head1,Head2,Head3,Head4,Head5,Head6
info1,info2,info3,,Info5,
"",,"",,"",""
InfoA,infoB,infoC,,,
Perhaps this example is impossible in all different cases.
Head1,Head2,Head3,Head4,Head5,Head6
info1,info2,info3,,Info5,
"","",,,,""
InfoA,infoB,infoC,,,
But completely blank lines before the headline can occur.
example 6. (row 1, 4 and 6 is empty)
row 7 has the wrong number of fields
Head1,Head2,Head3,Head4,Head5,Head6
info1,info2,info3,,Info5,
,"","","","",
InfoA,infoB,infoC,,,
,,,,,
,,