web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get all dates b...
Power Automate
Unanswered

How to get all dates between two dates in power automate desktop

(0) ShareShare
ReportReport
Posted on by 45

What i need is, user will get input dialog box like Start Date and end date. After giving input all the dates between two dates will get store into the excel sheet.

for eg:

Start Date: 02-03-2022

End Date: 10-03-2022

Output:

Rampage_0-1646198165268.png

 

I have the same question (0)
  • Verified answer
    VJR Profile Picture
    7,635 on at

    @Rampage 

     

    Here is a sample process which you can customise as per your needs.

     

    Copy-paste the below in a blank flow editor.

     

    Display.SelectDateDialog.SelectDate Message: $'''From Date''' DateDialogFormat: Display.DateDialogFormat.DateOnly IsTopMost: False SelectedDate=> FromDate ButtonPressed=> ButtonPressed
    Display.SelectDateDialog.SelectDate Message: $'''To Date''' DateDialogFormat: Display.DateDialogFormat.DateOnly IsTopMost: False SelectedDate=> ToDate ButtonPressed=> ButtonPressed
    SET ResultedDate TO FromDate
    Variables.CreateNewList List=> FinalList
    LOOP WHILE (ResultedDate) <= (ToDate)
     Variables.AddItemToList Item: ResultedDate List: FinalList NewList=> FinalList
     DateTime.Add DateTime: ResultedDate TimeToAdd: 1 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate
     DISABLE Display.ShowMessageDialog.ShowMessage Message: ResultedDate Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed2
    END
    Excel.LaunchExcel.LaunchUnderExistingProcess Visible: True Instance=> ExcelInstance
    Excel.WriteToExcel.Write Instance: ExcelInstance Value: FinalList

     

     

     

    VJR_0-1646201863490.png

     

     

    Output after running the process.

    You can work on the date formatting part in the flow.

    You can close the thread if this is good enough for you to get going.

     

    VJR_1-1646201952378.png

     

  • Rampage Profile Picture
    45 on at

    Can you tell me where is the blank flow editor locate?

  • VJR Profile Picture
    7,635 on at

    When you open the Power Automate Desktop tool, on the top left hand corner you will see "New flow" button.

    Hope you are using the Power Automate Desktop tool and not the Cloud flows 😊

  • Rampage Profile Picture
    45 on at
    Display.SelectDateDialog.SelectDate Message: $'''From Date''' DateDialogFormat: Display.DateDialogFormat.DateOnly IsTopMost: False SelectedDate=> FromDate ButtonPressed=> ButtonPressed
    Display.SelectDateDialog.SelectDate Message: $'''To Date''' DateDialogFormat: Display.DateDialogFormat.DateOnly IsTopMost: False SelectedDate=> ToDate ButtonPressed=> ButtonPressed
    SET ResultedDate TO FromDate
    Variables.CreateNewList List=> FinalList
    LOOP WHILE (ResultedDate) <= (ToDate)
     Variables.AddItemToList Item: ResultedDate List: FinalList NewList=> FinalList
     DateTime.Add DateTime: ResultedDate TimeToAdd: 1 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate
     DISABLE Display.ShowMessageDialog.ShowMessage Message: ResultedDate Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed2
    END
    Excel.LaunchExcel.LaunchUnderExistingProcess Visible: True Instance=> ExcelInstance
    Excel.WriteToExcel.Write Instance: ExcelInstance Value: FinalList

    where to insert this code?

  • VJR Profile Picture
    7,635 on at

    On the main screen of the Power Automate Desktop tool you will find the New flow button

     

    VJR_0-1646213021367.png

     

     

    Click on it which will open a new blank editor and paste the code there.

     

    VJR_1-1646213125104.png

     

  • Rampage Profile Picture
    45 on at

    Thanks for your help, its working

  • Rampage Profile Picture
    45 on at

    Rampage_0-1646225027777.png

    why i am getting output like this?

    expected output what i need is this:

    Rampage_1-1646225160169.png

     

  • VJR Profile Picture
    7,635 on at

    Just add a date formatting action in the first line after the loop starts

     

    VJR_0-1646277236687.png

     

    Your list will be generated in the right format

     

    VJR_2-1646277393192.png

     

     

    and you will see the output as below

     

    VJR_1-1646277305592.png

     

  • Rampage Profile Picture
    45 on at

    Rampage_0-1646281742374.png

    But in here why its changing format after 12th row? 1-12 is in Number format and after that all are in text how to resolve this?

  • VJR Profile Picture
    7,635 on at

    Delete that entire column (not just the text) and run the flow again or use a new excel file. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard