See the answers here, most are about using a CSV file:
c# - Populating a dataset from a CSV file - Stack Overflow[
^]
Something like this:
DataTable dtDataSource = new DataTable();
string[] fileContent = File.ReadAllLines(@"..\\Book1.csv");
string[] columns = fileContent[0].Split(',');
for (int i = 0; i < columns.Count(); i++)
{
dtDataSource.Columns.Add(columns[i]);
}
string[] rowData = fileContent[i].Split(',');
dtDataSource.Rows.Add(rowData);
if (dtDataSource != null)
{
dataGrid1.ItemsSource = dtDataSource.DefaultView;
}