i have excel in that column (ref ord no) how to write 1,2,3,4… etc till the line items present in that sheet1, so anyone could share linq query
You can use the below linq expression,
- Assign -> dt_Input = (From row In dt_Input.AsEnumerable()
Let rowIndex = dt_Input.Rows.IndexOf(row) + 1
Select dt_Input.Clone().Rows.Add(rowIndex.ToString())).CopyToDataTable()
If possible share the excel file based on that we will change the linq expression.
Hope it helps!!
Could you share your excel file… @Sathish_Kumar5
Based on that I’ll modify the linq exression.
Sample.xlsx (63.2 KB)
i shared the sample file also i have removed details and i have like more than 1400 line items in actual file
For linq query
excelData.AsEnumerable().ToList().ForEach(Sub(row) row(“NewColumn”) = excelData.Rows.IndexOf(row) + 1)
how to use this by assign data table of could share the workflow
Okay @Sathish_Kumar5
Follow the below steps,
→ Use Read Range workbook activity to read the excel and store in a datatable called dt_Input,
→ Use the assign activity to write the LINQ Expression, check the below expression,
- Assign -> dt_Input =(From row In dt_Input.AsEnumerable()
Let refordno = dt_Input.Rows.IndexOf(row) + 1
Select dt_Input.Clone().Rows.Add(refordno.ToString, row("ord typ"), row("distribution"), row("Division"), row("Customer"), row("Order Reason"), row("material"), row("quantity"), row("Unit"), row("Plant"), row("storage loc"), row("po"), row("rate"), row("frt"), row("Cus Name"))).CopyToDataTable()
→ Use the Write Range workbook activity to write the dt_Input to same excel.
Check the below workflow for better understanding,
Sequence1.xaml (11.3 KB)
Check the output file,
Sample.xlsx (53.0 KB)
Hope it helps!!
Thank you so much for your efforts in helping me and it worked
It’s my pleasure… @Sathish_Kumar5
Happy Automation!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

