Hi I am having 4 excel files I want to convert them into a single excel file, and the 4 excel files are having same row

Excel Automation

Hi,

One of the basic appraoches is to read 4 worksheet then write the first datatable to the result file,next append remaining datatables, as the following. We can use loop if necessary.

Regards,

1 Like

If we use if loop what should the input for append activity?

Hi,

Hope the following mock sample helps you.

Regards,

Here we have Append item to list activity what is the function of that activity???

It’s for append item to List.
For example, assume the following List<string> type variable

listStr = New List(Of String)From{"A","B","C"}

AppendItemToList activty can add item to the list as the following.

Regards,

How can we merge last 7 days excel files into a single excel file

In if condition you written idx=0 what it means??

This is for writing data including header at the first time. (No need to write header 2nd or later.)

How can we merge last 7 days excel files into a single excel file

How do we get the date of file? Is it filename or datetime from filesystem such as create date?

Regards,

from file name we will get the date and can you please explain me the code

Hi,

If filename ends with yyyyMMdd style date (ex sample20230404.xlsx), the following expression will work.

arrSrcXlsx = System.IO.Directory.GetFiles("yourFolder","*.xlsx").OrderByDescending(Function(f) System.Text.RegularExpressions.Regex.Match(System.IO.Path.GetFileNameWithoutExtension(f),"\d{8}$")).Take(7).ToArray

Regards,

IN this code you have written like {} idx,{} CurrentItem, {} listDt what does it meant and what is the data type of variable?

Can you check the following xaml?

Sequence.xaml (11.1 KB)

assign:atleast one object must implement icomparable getting this array for 2 second assign activity

HI,

Sorry i had a mistake. Can you try the following project?

System.IO.Directory.GetFiles(System.Environment.CurrentDirectory,"*.xlsx").OrderByDescending(Function(f) DateTime.ParseExact(System.Text.RegularExpressions.Regex.Match(System.IO.Path.GetFileNameWithoutExtension(f),"\d{8}$").Value,"yyyyMMdd",System.Globalization.CultureInfo.InvariantCulture)).Take(7).ToArray

Sample20230405-1L.zip (3.1 KB)

Regards,