Select one row from Excel

Hi,
I need to select only row1 of data, not rest of the rows, not the headers and add to a data table. Repeat this for few Excels by reading row1 and adding to a datatable. I have to write these rows into another excel. How to do this?

Thank you,

Hi @A_Learner

Can you try the below

Sequence.xaml (17.5 KB)

Regards,

@A_Learner

Try this

this will loop through each file and then add row to datatable only first

Excel.Sheet("SheetName").DataTableOutValue.AsEnumerable.First().ItemArray

cheers

1 Like

@Anil_G
Thank you. I am getting an error assigning itemArray to datatable.

@A_Learner,

  1. Iterate all files using For Each File in Folder
  2. Use Workbook Read Range activity for reading the excel files. This will be faster than Excel Process Scope. Store this in temporary datatable for each scope.
  3. Add Data Row from to a datatable variable scope should be out of for each file activity.
  4. Write range to workbook.

Sample Code:
Workflow1.xaml (13.3 KB)

Thanks,
Ashok :slight_smile:

@A_Learner

Are all files having same number of columns filled?

Can you tell the error

Cheers

Add Data row - Object reference not set to instance of an object.
I think declaring the datatable as a variable and not initializing throwing me error.

Thank you

1 Like

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