Bug report
Test script to replicate the problem. If someone could confirm that would be helpful. If you are reading multiple rows or columns in a row using CSV_ReadRow and/or CSV_ReadCol it "appends" your previous column or row to what is returned from the function, so you send up with multiple rows which is not what you expect.
Bugfixes for those who have this lib below the test code, add two lines see comments
Code:
f=testing.csv
csv= ; create test data file
(
1,2,3
4,5,6
7,8,9
0,a,b
c,d,e
)
FileDelete, %f%
FileAppend, %csv%, %f%
CSV_Load("testing.csv", "data") ; read testing.csv
Loop, % CSV_TotalRows("data")
MsgBox % CSV_ReadRow("data", A_Index)
Loop, % CSV_TotalCols("data")
MsgBox % CSV_ReadCol("data", A_Index)
/* Bug fixes
CSV_ReadRow(CSV_Identifier, RowNumber)
{
Local CellData
CurrentCSV_TotalCols := %CSV_Identifier%CSV_TotalCols
RowData= ; add this line
Loop, %CurrentCSV_TotalCols%
{
RowData .= %CSV_Identifier%CSV_Row%RowNumber%_Col%A_Index%
If A_Index <> %CurrentCSV_TotalCols%
RowData .= "`,"
}
Return %RowData%
}
CSV_ReadCol(CSV_Identifier, ColNumber)
{
Local CellData
CurrentCSV_TotalRows := %CSV_Identifier%CSV_TotalRows
ColData= ; add this line
Loop, %CurrentCSV_TotalRows%
{
ColData .= %CSV_Identifier%CSV_Row%A_Index%_Col%ColNumber%
If A_Index <> %CurrentCSV_TotalRows%
ColData .= "`,"
}
Return %ColData%
}
Edit
Bug in CSV_LVSave:Format4CSV isn't used while exporting Listview data, quick fix:
In CSV_LVSave change line
Code:
FullRow .= CellData
to
Code:
FullRow .= Format4CSV(CellData)
Further improvement would be to skip empty rows although should probably be a parameter.