Hopefully you guys can help me out with this one. I’ve tried breakpoints and a couple debug methods but to no avail.
My automation reads a range (4 rows of values) from one spreadsheet, then needs to write it to a second spreadsheet in a specified row (“C” + (masterDashboardDT.Rows.IndexOf(row) + 1).ToString). I’ve checked this value and it correctly shows as C180, which is the cell I would like to write my values.
So it is not writing for any of the row in that loop, could you please put the “valuesToCopy” into a output datatable and check it in a message box. I am suspecting that is not holding correct value and hence not writing properly
@sarathi125 basically, the first datatable is arranged alphabetically, the second datatable is not. i get the name from the first datatable, then use for each row to loop through and find that name in the second. once found, I want to paste the values from the 1st datatable into the 2nd one, at the row found
One tip for you is, if the excel is the same, dont put your excel scope activity inside the Loop, but the other way around, so it wont get open and closed so many times… Also check if the Scope has autosave enabled or put a save workbook after writing the value…
@bcorrea I have to write the information in 4 cells, C180, D180, E180, F180. The valuesToCopy variable is from a Read Range that read from 4 cells B2, C2, D2, E2 in a separate spreadsheet.
Which is essentially “C180:F180” in this example. Still, nothing is being written in this sheet. I’m very confused, cause I’m unsure how to debug this and figure out exactly what’s going on.
@bcorrea Alright, so a bit of an update… I replaced the original “Read Range” to 4 “Read Cells”, storing each value as a variable. I then used 4 “Write Cells”… and it works!
This is a bit excessive though, I’m unsure why my Read Range didn’t work with “B2:E2” and not get written to “C180:F180”
I was hoping to just selected these 4 cells from one spreadsheet and copy paste them into a row in the second spreadsheet
well i guess read range will give you a datatable, write range if used in the middle of another table would be strange, so i think you are better of with separate cells
Thanks for all the help @bcorrea! I’m still gonna brainstorm and see if there’s another method of selecting those 4 cells through one activity and pasting them using another, could simplify the automation and make it a bit more elegant.
no prob, i mean you can still use Read Range to dtVariable, but use 4x write cell like this: dtVariable.Rows(0)(0),dtVariable.Rows(0)(1)… and if you will do that a lot, you can extract that part as new workflow file and invoke it passing parameters.