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
- Drag and drop the Read Range activity onto your workflow.
- In the Range property, provide the range of cells that includes the entire column you want to read from, for example C:C
- Check the “AddHeaders” checkbox if the first row of the column contains header names that you want to include in your output.
- Assign the output of the Read Range activity to a variable of type DataTable.
- Create a new DataTable variable to store the output data.
- Loop through each row in the DataTable you read in the previous step.
- 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.
- 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.
- Drag and drop the “Write Range” activity onto your workflow.
- In the “WorkbookPath” property, provide the path to the Excel file that you want to write the new column to.
- In the SheetName property, provide the name of the worksheet that you want to write the new column to.
- In the Range property, provide the starting cell of the new column, for example “D1”.
- In the DataTable property, provide the DataTable variable that contains the new column data.
I hope it helps you.