/// <summary> /// Read a CSV file into a table /// </summary> /// <param name="filename">Filename of CSV file</param> /// <param name="headerRow">True if the first row contains column names</param> /// <returns>System.Data.DataTable object that contains the CSV data</returns> public static List<PersonModel> readPeopleFromCSVFile(string filename, bool headerRow) { using (CSVWeaveReader reader = new CSVWeaveReader((TextAsset)Resources.Load(filename))) return reader.readAllRows(headerRow); }
/// <summary> /// Read a CSV file into a table /// </summary> /// <param name="filename">Filename of CSV file</param> /// <param name="headerRow">True if the first row contains column names</param> /// <returns>System.Data.DataTable object that contains the CSV data</returns> public static List<PersonModel> readPeopleFromWeaveCSVFile(string filename) { //Debug.Log(">>>> text asset = " + (TextAsset)Resources.Load(filename)); TextAsset textAsset = (TextAsset)Resources.Load(filename); using (CSVWeaveReader reader = new CSVWeaveReader(textAsset)) return reader.readAllRows(true); }