Excel in sequence

how to set this excel in sequence according to the date feb then march april

i am adding data daily with current data and want that to current date at the end of it

data.xlsx (8.8 KB)

@manoj_verma1
Read the excel with read range , use sort datatable activity to sort the datatable to acending order and then rewrite the datatable to same excel

image

image

Give the column index and order type

cheers
muhamed fasil

Hi @manoj_verma1 ,

With a Linq Approach we can have the Following Expression in an Assign Activity which will order the Rows According to the Date values :

DT= DT.AsEnumerable.OrderBy(Function(x)CDate(Split(x("Date").ToString,".")(0).Trim)).CopyToDatatable

Here DT is the Datatable variable that contains the Data of the Excel Sheet.

1 Like

@muhamed.fasil
@supermanPunch

how to pick file name as 24-Feb-22 in ascending order from a folder

@manoj_verma1 , I am not quite sure I understand your Question.

Do you want to Select the 24-Feb-22 value meaning this value is provided as an Input ?

But again what does “in ascending order” mean ?

actually i have a folder where i have files date like 24-Feb-22 in want to pick them in ascending order i.e 24 then 25 …

@manoj_verma1 , In that case, Are you using the Excel that you have provided to us ?

I would say even without the Excel, we can fetch the files in the Order as Required like below if we know the Folder Path where the files are present :

filePaths = Directory.GetFiles("YourFolderPath","*.xlsx").OrderBy(Function(x)CDate(Split(x.ToString,".")(0).Trim)).ToArray

Here filePaths is an Array of String type variable, which will have the file paths in the ascending order of the dates in their file names.

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