Read column data

Dear Robogen, How can I read and write data from a column? when the last cell of column is not specific. Suppose, column starts from C1, but last cell may be C12, C13 or C15 not specific. Please kindly help.

Hi @Sabbir_Anwar ,

You can just put C1 in read range. It will automatically take remaining data.

1 Like

Hi @Sabbir_Anwar

  1. Drag and drop the Read Range activity onto your workflow.
  2. In the Range property, provide the range of cells that includes the entire column you want to read from, for example C:C
  3. Check the “AddHeaders” checkbox if the first row of the column contains header names that you want to include in your output.
  4. Assign the output of the Read Range activity to a variable of type DataTable.
  5. Create a new DataTable variable to store the output data.
  6. Loop through each row in the DataTable you read in the previous step.
  7. Use an “If” statement to check if the value in the first column (C) of the current row is empty or not. If it is empty, break out of the loop.
  8. Otherwise, add the value in the first column to a new DataRow object, and then add that DataRow object to the new DataTable you created in step 7.
  9. Drag and drop the “Write Range” activity onto your workflow.
  10. In the “WorkbookPath” property, provide the path to the Excel file that you want to write the new column to.
  11. In the SheetName property, provide the name of the worksheet that you want to write the new column to.
  12. In the Range property, provide the starting cell of the new column, for example “D1”.
  13. In the DataTable property, provide the DataTable variable that contains the new column data.

I hope it helps you.