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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

ISO Week Number

(0) ShareShare
ReportReport
Posted on by 6

Is there any way to obtain the ISO week number and turn it into a string variable?

  • Verified answer
    evilnw Profile Picture
    84 on at

    Try to use "Run PowerShell script" action with code %'get-date -UFormat %V'%. Dont forget Trim result.

    evilnw_0-1666939424299.png

     

     

  • lightningdog Profile Picture
    6 on at

    Hi @evilnw , thank you for the tip! I just realized you can run scripts. So I used the following python script to output the wk number to a string variable:

     

    from datetime import date
    today = date.today()
    isodate = today.isocalendar()
    print (isodate[1])

     

    Another problem I am running into now is that I am trying to send an email with an attachment with a variable filepath that includes the wk number as a string:

    U:\I\abc\def\Example(Week%str_isowknum%_%str_year%).xlsx

    However I am getting a runtime error. The file exists and the email sends successfully when I replace the variables with the actual name of the file.....

     

    The error states: U:\I\abc\def\Example(Week%str_isowknum%_%str_year%).xlsx not found

    Details are:

    Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Attachment U:\I\abc\def\Example(Week%str_isowknum%_%str_year%).xlsx not found. ---> System.ArgumentException: Illegal characters in path.
    at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
    at System.IO.Path.GetFileName(String path)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
    at MimeKit.AttachmentCollection.Add(String fileName)
    at Microsoft.Flow.RPA.Desktop.Modules.Email.Actions.EmailActions.AddAttachment(String fileName, AttachmentCollection attachments)
    --- End of inner exception stack trace ---
    at Microsoft.Flow.RPA.Desktop.Modules.Email.Actions.SendEmail.Execute(ActionContext context)
    at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

     

    Is this a bug? The program seems to think I am using a character that is not allowed?

  • evilnw Profile Picture
    84 on at

    I think problem with string attachment(s). Variables are not converted to values. Can you show screenshot with your attachment(s) string?

     

    evilnw_0-1666970562053.png

     

  • lightningdog Profile Picture
    6 on at

    Attachment is as follows:

    U:\I\abc\Request\%stryear%\Request Week%strisowknum% %stryear%.xlsx

     

    Name of actual attachment is:

    Request Week44 2022.xlsx

    Variables used are both text values/strings:

    lightningdog_0-1667204108805.png

     

    I'm ready to pull my hair out!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 211 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 190

Last 30 days Overall leaderboard