Paste extracted xml data on the last row of excel sheet

Hi there,

I was trying to paste out my data which is extracted from multiple xml files on the last row of excel sheet. This is how my excel sheet looks like.


I was about to paste out my data on row 2 onwards. But everytime I read in another xml file the data paste back to the row 1. So can anyone please help me with this issue?
Attaching my xaml file as below.
XML.xaml (23.6 KB)

I appreciate any reply from you. Thanks in advance.

Regards,

Hi,

BuildDataTable activity creates new DataTable and your index (= newDt_List.Rows.Count + 1 ) always returns 2.
Are there headers in your excel file in advance?
If so, perhaps you can remove this activity (Build DataTable).
Can you try?

Regards,

@yushinchan

Use Append Range activity to append the data to already existing data.

1 Like

Hi @Yoichi
Are you means that I need to remove Build Data Table activities?

Hi @lakshman
I will try and work on this activity. Can you explain further about it?
Thanks for your sharing.

1 Like

Hi,

Yes, if your excel sheet has headers at initial, because you can get whole data using read range activity before Build Data Table.
If your excel sheet doesn’t have headers, you need to if activity and use Build Datatable Activity at 1st time only.

Regards,

Hi,
My excel file is an empty file. I put the header using the Build Datatable Activity.

@yushinchan

You are reading different XML files and writing data into same excel file right ?

Hi,

I added If activity to your workflow.
Can you try the following?

XML.xaml (28.5 KB)

Regards,

Yes that’s right :')

1 Like

Hi @Yoichi
It’s work when I read in the xml file one by one. But once I use Read Multiple XML Files - #13 by yushinchan to read in multiple xml files, it turns up to be paste in the first row again.
Attaching my ReadMultipleXml file.
Read Multiple XML.xaml (16.9 KB)

Hi,

Can you try the following step?

  1. Move your Excel application scope activity after the inner For each activity (iterate xml_Out). in the outer For Each Activity(for iterrate s_path).

  2. Modify workbook path property of Excel Application Scope Activity as the following.

"C:\Users\UTAR04480\Desktop\Read XML and Store into Excel - Updated\Demo_"+System.IO.Path.GetFileNameWithoutExtension(item.ToString)+".xlsx"

Regards,

Hi @Yoichi
It’s works with the first step :')
Thanks so much for your afford

1 Like

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