Date for Each Row

Okey, few days ago I published a post trying to set the actual date doing an update, but now I don’t want an update.
When I get the data from an excel and paste it I want that in the other excel where the info are pasted, set the actual date in the column W. Why update doesn’t work? Because the excel where the info are obtained don’t have a specific column for date, so I need something like a for each with activities or linq. I try with for each row and with write range but nothing.
Captura de pantalla 2022-02-07 113030

Hi!

Are you getting any error while performing write range?

Instead of using the write range. can we try with writecell activity. with the help of counter=0.

Crate a counter inside the for each and do the operation then in the range mention"W+CounterVariable"

Regards,
NaNi

Hi @ShadowZ,

Please let us know if you are getting any error.

Thanks

I’m not getting an error but the problem that I have is this:

  • Imagine that i have 100 values with the date of the day before in the Excel2 (the excel where the info are pasted). And today the RPA obtain 50 values of the Excel 1 and paste it with append range. The problem that I have is that the date are being setted in all the values of the column W and I just want to set this actual date to the 50 values obtained form Excel1, the other 100 values that I obtained yesterday I want to keep it with the date of the day before, not change all. This is why I’m triying to do it with write wrange.

Can you give me pls an screenshot with the activities to know how to do it becuase I’m confused. Thanks a lot.

Hi!

Could you please provide the sample input and also expected output!

Regards,
NaNi

Hi!

Logic:

"W"+Counter.ToString

WriteCell

Reference:

Regards,
NaNi

Item.(5) what does it mean?

Hi!

That is the text value: The value to be written to a cell or range.

Regards,
NaNi

Sorry but doesn’t work.

  1. I do it exactly as you show an I’m getting an error saying thta W0 not exists.
  2. I fixed it putting the count start at 1 but the info are being pasted at the start not with the info obtained. I’m going to show you an easy example to try to explain what I want:

The example that you give me it’s on the good way but somthinh is mesing

Hi!

The logic which we used is correct! Could you please check the read range which the add headers is checked or not?

And also check the index. as we’re writing the date to the W0 Column. Check the excel and add the counter.

in the above snap we need to update Column date from B5. so our write cell should look like this “B5”+Counter.ToString

Regards,
NaNi

Hi @ShadowZ

You try this logic

After appending the value in the “Excel2.xlsx”

Read the Excel2 → Using Read Range Activity

Create an output variable as → dt

Use For each row in Data Table

Use if condition → CurrentRow(“Date”).ToString.Equals(“”)

Then

Use Assign activity
LHS → CurrentRow(“Date”)
RHS → DateTime.Now.ToString(“dd/MM/yyyy”) → Get the current date

    DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy") -> To get the Yesterdays Date

Use Write range activity to write the data in the append value

Refer to the screenshot

Hope it will works

Regards
Gokul

When you do write wrange on the text value I can’t use the datatable so I’m going to try with CurrentRow.(“Date”)

Use need to give in the Assign activity not in the write range

image

You can only use DataTable in the write range try like above solution it will work as expected.

Regards
Gokul

Why I’m getting an error saying the cell doesn’t exist?

Can you share the excel file @ShadowZ

Libro1.xlsx (879.1 KB)

If possible can you share with the sample data @ShadowZ

Okey, I’m going to share you the 2 Excels.

  1. Where the info are obtained (Excel1)
  2. Where the info are pasted (Excel2)
    Excel1.xlsx (8.4 KB)
    Excel2.xlsx (879.3 KB)

Another problem that I have is that the info with append range are pasted under the color blue, because the original document( Excel 2 ) have formulas. I tried with write range but the other info are suplemented and I don’t want this