Unable to copy the values in the 1st column of the Excel file to website

Hi,

I am unable to copy only the values present in the 1st column “A” of the Excel file to a Website. I have used couple of activities to copy the values but is copying all the values (50124 ABC 50124|ABC) in the Excel file.

Excel values:

image

Value (Column A) to copy (excluding header):

image

Activities used:

@Karunamurthy

Please try this

This will join all the values with comma and make it a string

Requiredstring = String.Join(",",Dt.AsEnumerable.Select(function(x) x("Member ID#").ToString))

You can change "," to Environment.NewLine

Cheers

1 Like

Hello @Karunamurthy

  1. Use Excel Application Scope (to open the Excel file)
    WorkbookPath: “PathToYourExcelFile.xlsx”

  2. Read Range (to read values from Column A, excluding the header)

    SheetName: “YourSheetName”,
    Range: “A2:A100”, // Adjust the range as per your data (excluding the header)
    DataTable: dtValues

  3. Assign
    valuesToCopy = String.Join(Environment.NewLine, dtValues.AsEnumerable().Select(Function(row) row(0).ToString()))

  4. Use Web Automation activities to navigate to the website and paste the values (valuesToCopy) into the desired field on the website.

  5. Close Excel Application Scope

Thanks & Cheers!!!

Hi @Karunamurthy,

dt - this replace with your datatable variable which take whole data from the sheet.


String.Join(",",dt.AsEnumerable().Select(Function(row) row.Field(Of String)("Member ID#")).ToList().ToArray)