I want to copy previous month data and paste into another excel sheet

Hello All,Preformatted text

I want to copy previous month records(december [8.12.2021]&[14.12.2021]) from attached excel screenshot (Delivery Date) and (No of Litres) and paste it into another sheet.

Can anybody please help me in this?

1 Like

Hey @Poonam_Yadav

Unable to see the attached excel, Kindly re-attach it please…

Thanks
#nK

Hi @Poonam_Yadav,

As you mentioned in your query, there is no excel document. Can you share the document which would be helpful to sort out the issue further.

Regards,
@90s_Developer

Hi! @Poonam_Yadav ,

if you wants to write the existing columns in to another excel please follow the below steps:

1.Excel Application inside that Read Range from Excel output as dt1.
2.Take one for each row in data table. mention as dt1.
3.Take one Build Data table and create the required columns like this column1,Column2 and so on… output as BuildDt
take required assign activities

  1. Column1=CurrentRow(“ColumnName”).ToString
  2. Column2=CurrentRow(“ColumnName”).ToString

Take one Add data row activity->Properties ArrayofRow pass the values like this

{Column1,Column2} and mention dt as BuildDt.

Outside the all for each rows

Take one Excel Application Scope

Write range from Excel output as BuildDt

save and run

Regards,
NaNi

Hi @Poonam_Yadav,

Follow the below steps,

  1. Use Build Data, and create the columns which you required in the output datatable. According to your query create two columns [Delivery Date, No of Litres]
    image
    and create the datatable variable for the build datatable e.g: OutputExcelResultDT.
    image

  2. Now, read the input excel which you have the data using Read Range (Workbook) and create the datatable variable for that read range e.g: MailExcelDT
    image

  3. Now use assign activity and assing the value to the Build Datatable variable
    OutputExcelResultDT = (From dr1 in MailExcelDT.AsEnumerable() Select OutputExcelResult.LoadDataRow(New Object() {dr1("Delivery Date").ToString, dr1("NoOfLitres").toString},false)).CopyToDataTable

  4. Use Workbook Write Range activity, and pass the OuputExcelResultDT as the input.
    image

Based on the column you required, you need to fill into the expression by adding the values with the required column from the main excel

NOTE:

OutputExcelResultDT - newly created Datatable which is further passed as the input to the write range
MailExcelDT - Datatable variable which holds the main file data.

I hope you will be able to achieve your result with this LINQ query.

Regards,
@90s_Developer