My problem is that I would like to print a value in one column if there is a value in another column!.
For example, if the value in the first column is S2 or S3, I would like the letter A to appear in the third column.
Thank you!
Welcome @Maria_Ines_Almeida!
Typically this is how it works based on your image, I presume that your input values are in cell A (index 0) and you want to write values back into Cell C (index 2). I’m writing simple pseudo-code here. You may want to look up how to read data from a Data Table and also the Write Cell Activity
In Excel Scope Activity
Read the Excel sheet into a data table say, DT1
In the ForEach row in Data Table DT1
if row(0).ToString="S2"
Use Write Cell activity to write to cell address Cx of each row
' where x is the number of each row which will translate to C2,C3, ... etc
Else
End If
Thank you very much for your answer!
But if I have 100 cells to fill, I would have to have 100 write cell activities and that’s what I was trying to avoid
No.
You may have to come up with a logic to write to those 100 cells on each row inside the ForEach activity.
If the cell ranges you are writing to are continuous (say C through E) then you can come up with something like Cx:Ex
If you have 100 cells, then your logic will most likely go beyond column Z in each row.
Therefore you may have to figure out a logic to dynamically figure out the cell position in terms of its index and then feed it to the Write Cell activity
Example: Index of column Z is 25, and the Index of the next column AA is 26 and so on.
Just one way of how this could be done.
Here is something I came up with in the last 30 minutes.
- Sheet1 is a mockup of your image above
- Sheet 2 is the results of writing to several cells of each row.
- For the sake of time I have limited it to about 12 columns
- Caveat is the cell ranges are contiguous
- You have to mod it if your cells have intermittent breaks in the range
MaInesAL.xlsx (9.8 KB) Seq_Write_To_100_Cells_Excel.xaml (11.9 KB)
I shared this with you because I will be needing this for upcoming changes to another project that is soon coming my way.