Documentation > CMS Template API Library > Util > CreateListFromCsv(String,Char)

CreateListFromCsv

Converts CSV file contents into a List of Dictionaries. Requires the first line in the data to be column headers.

public List CreateListFromCsv(String,Char)



Parameters

NameDescriptionType
csvData

CSV data with column headers on first line

System.String
separator

Optional: The character to delimit the data. Defaults to ,

System.Char

Code Example

C#

Sample:

            		
            <%
            List<Dictionary<string,string>> list = Util.CreateListFromCsv(testText, ',');
            foreach(Dictionary<string, string> dictionary in list)
            {
              string data = dictionary["colName1"];
            }
            %>
            
            	

Connect with Crownpeak