Write data in column excel?

I want to read column product and Count in file config.
column product = sheet name in file input

I want to write column Sum in file input by check value in file config.

image

Please guide me for solve it.

1 Like

@Ramya_K @Nithinkrishna You can guide me this case?

Hi @fairymemay,

If u are using a newer version u should have the “Get Workbook Sheets” under excel activities, then u could try the following logic:

  1. Build a dataTable that will be your “File Config”:


    I called mine “fileConfig”.

  2. Use Excel application Scope to read the “File Input”

  3. Use Get Workbook Sheets to get all Sheets name (“AA”, “AB”)
    image
    Get Workbook sheets will return u a List that contains all the names of the sheets. I called my variable “sheetsNames”

  4. Make a for each loop to loop through all sheet names:

  5. Inside the for each:

5.1. Use a read range and pass the sheet variable (or “item” which is the default name) to read all your sheet

5.2. store the result in a variable: I called mine “dtSheet”

5.3. Use Add Data Row to add a row in the “fileConfig” dataTable (which we created on 1.)
Pass an arrayRow like the following:

{sheet, dtSheet.AsEnumerable.Sum(Function(x) Convert.ToDouble(x("Sum").ToString.Trim) ).ToString}

And the dataTable should be “fileConfig”

image

Finally use the write range (i`m using the one under File System activities, so i need to pass the path) like the following:

image

This Write Range should be outside the for each!

Hope it helps.

BlankProcess1.zip (16.5 KB)

@Schirru No.

I want to copy value from column Count in file Config —> write in file input column Sum.

Can u check the following, please?

BlankProcess1.zip (16.2 KB)

1 Like

@Schirru I have a question.

If I don’t want fix column T. But I use column header name (Sum) to fix.

How edit it ?

1 Like

@fairymemay, can u try to replace the expression with the following:

String.Format("{0}2:{0}{1}",Chr(96 + (dtSheet.Columns("Sum").Ordinal + 1)), dtSheet.Rows.Count + 1)

Let me know if it helps.

1 Like

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