How to Write status into the excel after reading the data from the data table

datatable
excel
activities

#1

Hi,

I’m currently getting data from the excel to data table and processing the data directly from the data table. Now I need to write the status for successfully completed process in the excel.

The status should write parallely to the processed data.

Anyone please help me to sort out.

Thanks.


#2

@Shansun

Try to add new column to the datatable in which you are processing using Add Data column. Write the status for every record you are processing in that new column.

Regards,
Ranjith.


#3

Thanks @Ranjit, Could you tell how to write those data in excel or CSV?


#4

use write range activity to write the entire datatable into csv or excel


#5

Can you attach any sample XAML?


#6

Hi,

Thanks Ranjit. I’ve added the column to existing data table. Now How can I write all the column in CSV or excel.


#7

@Shansun Do you want to write a new column into the same sheet where you initially read the datatable for processing?


#8

Yes, Exactly!


#9

Have you added the new column to existing datatable? then use Write range activity to write the value into excel or Write csv activity if you want it in csv file


#10

Yes, simply I’ve assigned the column name field as “Status”. Not mentioned in column field


#11

Yes, I’ve added new column to the existing data table successfully.


#12

Then use “Write Range” or “Write CSV” with the sheet name,file path and datatable name.


#13

Thankyou so much for your quick reply! How to write value in the data table against the newly created column.

Great.


#14

I want to put status value like “Pass” or “Fail” in the column


#15

hi ,

Can anyone please fix this issue.
How to pass values to the datacolumn


#16

@raji, Many ways to update ! One among would be running a for each row and assign row(“ColumnName”) = Value

References : How to Append Column to A Scrap Result Data Table?

Regards,
Dominic :slight_smile:


#17

Yes…But i have read column from one excel with variable datatype as IEnumerable objects.

I have to append this column in another excel.

For this , i have given add data column and mentioned the datatable and the column name.

BUt i dont know how to add that data in this excel.Sample_Excel.xaml (11.7 KB)


#18

Hi,

I am attaching a .xaml file and 2 xls to check the solution.
One xls has a table with some values.
Another xls is empty which will be filled with data copied from the first xls.
I have also added a column and written data to it like Pass, Fail using write cell.

One of the reason you did not see the newly added column was because you have not checked Add Headers. If you do so, your column is already being added and written to the excel. It was a simple mistake.

For writing data in the excel, there are many options, like Write Cell, Append etc. You can also tweak your logic to update the datatable first with the required Pass fail values and then directly write it.
Or you can put the Write Cell in a loop if you are performing other operations to find out whether it is a pass or a fail etc.

Hope this will solve the main problem of yours so that you can tweak the solution as per your needs.

Cheers
Praveen Kumar
Director - Technology, Nanite Solutionsappends.xlsx (7.9 KB)
res.xlsx (8.5 KB)
Sample_Excel.xaml (14.2 KB)


#19

Thanks for your valuable time.

but i have to pass the column values which i have read it as name-IEnumerable objects.

I am not able to pass this variable in write cell or write range.


#20

I have to append the particular column in the new excel which is having seven columns.