Excel line with same dates and combining

Im working on a sample project right now and a problem I’am having is taking all line items in my excel with the same dates and combing them as a singular invoice. I know what its talking about i just do not where to start from.

Are all dates in either the same row or same column? If so, then you can use read range to get the file to a datatable.

If it’s all in a column, then you can use a SELECT statement to filter on that column. Then, use Invoke Method to import rows into a new datatable for the dates you want.

If it’s all in a row, then you have to find the index of that row through some means. Then, use a for each statement to loop through each column of that row.

Super high level, but hope that helps you get started

Hi @kishanpatel728,

Considering dtInput is your datatable,
dtOutput is the resultant datatable and
ColumnName is the name of date column for which you want to combine the invoices.
Use assign statement dtOutput = dtInput.DefaultView.ToTable(true, “ColumnName”)
The dtOutput datatable will now have all the unique records.
Loop through the dtOutput datatable
For each rows “drRow”, Use select statement to retrieve the same dated records from dtInput datatable.
matchingRows = dtInput.Select(“[ColumnName] = '” + drRow.item(“ColumnName”) + “'”)

Hope it helps!
If you still have doubt, Please send sample data and we could use the data to build a xaml.

1 Like