As you can see, I am trying to add a new column(“View”) to the datatable and each row of column view has a set of values which will repeat every day when I run the script.
Please note that I will be running this script daily to append data. So currently the screenshots has 3 rows for today, but tomorrow it will be 6 rows
You can approach this Scenario as below:
Create a Excel File “Output” with “View” Column (If not created).
Read the Excel File without View Column.
Add Column “View” in DataTable.
Append the DataTable in the Excel File “Output”.
To avoid repeat.
First create a new excel/csv file.
Then you ll need to use new datatable (with View column) to append the data to excel/csv and clear the same datatable after each append activity.
To avoid headers in consecutive runs:
check if the new file exists, if yes use append activity. if no, create file with headers.