We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Databiding to SfDataGrid of a CSV file with XlsIO

I'm trying to open a CSV file with XlsIO in a Universal Windows app and I want to databind the result to a SfDataGrid column with auto-generate columns as true. I'm struggling as I can't find any help. I'm writing this:

var picker = new FileOpenPicker();

picker.ViewMode = PickerViewMode.List;

picker.SuggestedStartLocation =



var tempFile = await picker.PickSingleFileAsync();

if (tempFile != null)


var exStream = await tempFile.OpenStreamForReadAsync();

ExcelEngine excelEngine = new ExcelEngine();

IApplication application = excelEngine.Excel;

IWorkbook workbook = await application.Workbooks.OpenAsync(exStream, ",");

var data = workbook.Worksheets[0].Rows;

this.CsvGrid.ItemsSource = data;



Of course this databinding does not work and throws an exception. And because this should not be read-only, I would need to generate an ObservableCollection from the CSV's rows but I can't figure out how to extract a collection of rows from the worksheet. Any help please?

3 Replies

JG Jai Ganesh S Syncfusion Team April 4, 2016 03:49 PM UTC

Hi Alessandro,

We have analyzed your query and we regret to inform you that, you cannot directly get the items from WorkBook and assign it to Grid’s ItemSource. We need to manually get the items from Worksheet and assign it to a collection then assign the Grid’s ItemSource.

UG Links:




Jai Ganesh S

AD Alessandro Del Sole April 6, 2016 07:35 AM UTC

Thanks for your kind reply, I'll be looking through the links you provided.

JG Jai Ganesh S Syncfusion Team April 7, 2016 05:48 AM UTC

Hi Alessandro,

Thank you for the update.

Please let us know if you need further assistance on this.

Jai Ganesh S

Live Chat Icon For mobile
Up arrow icon