How to save String value to array

I have “For Each” loop from excel sheet
I want to store the value from the excel to the save to variable “ProcessMessage(0)”
How I need to write it correctly ?

image

Hi @mironb

You have to write it this way:

ProcessMessage(0) = CurrentRow("ColumnName").ToString

Replace “ColumnName” with the actual column name or index where your data is stored. ProcessMessage is of DataType Array(System.String).

Hope it helps!!

@mironb
What is the datatype of the variable ProcessMessage(0)

@mironb

<ForEachRow activity: For Each row In dt
<Assign activity: ProcessMessage(0) = row(0).ToString

@pravallikapaluri
image

@mironb

  1. Use Excel Application Scope:
  • Drag and drop the “Excel Application Scope” activity.
  • Specify the Excel file you want to work with.
  1. Read Range:
  • Drag and drop the “Read Range” activity.
  • Set the Excel file and sheet name, and create a DataTable variable to store the data.
  1. For Each Row:
  • Drag and drop the “For Each Row” activity.
  • Set the DataTable variable from the “Read Range” activity as the input.
  1. Assign Activity:
  • Inside the “For Each Row” activity, drag and drop an “Assign” activity.
  • Set the left-hand side to ProcessMessage(0).
  1. Retrieve Excel Value:
  • Set the right-hand side of the Assign activity to row("YourColumnNameOrIndex").ToString().
  • Replace “YourColumnNameOrIndex” with the actual name or index of the column in your Excel sheet.
  1. Complete the Workflow:
  • Your workflow is now set up. When the “For Each Row” loop runs, values from the specified column in each row will be assigned to ProcessMessage(0).

@Krishna_Raj

@rlgandu

@mironb

Assign activity: ProcessMessage = New String(10) {}

For Each Row activity: row In dt
Assign activity: ProcessMessage(0) = row(“ColumnName”).ToString

End For Each

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.