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 / Automatic refresh of =...
Power Automate
Unanswered

Automatic refresh of =today() function in spreadsheet

(0) ShareShare
ReportReport
Posted on by
I'm having trouble getting Power Automate to use the right date from an Excel spreadsheet. I have a flow that's supposed to read a spreadsheet with a column that has the formula '=today()', which is fundamental to the flow is supposed to do.
 
But the flow keeps using yesterday's date (or the last date I opened the spreadsheet) instead of today's. I've tried adding a script to the spreadsheet to refresh it but it was unsuccessful.
 
I also thought about using an Excel spreadsheet with a macro that runs before the flow starts. Unfortunately, I couldn't get Power Automate to work with the .xlsm file (when using ‘List rows present in a table’.
 
Any suggestions on how to get the flow to properly refresh the date column before running the next steps and without the need of opening the spreadsheet in my PC before it runs?
 
The spreadsheet is saved in a Sharepoint. 
Categories:
I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    You can write an Office Script to do this. Here is an example:
     
    function main(workbook: ExcelScript.Workbook) {
        // Get the active worksheet
        let sheet = workbook.getActiveWorksheet();
        // Get all used ranges in the worksheet
        let usedRange = sheet.getUsedRange();
        // Loop through each cell in the used range
        usedRange.getValues().forEach((row, rowIndex) => {
            row.forEach((cell, colIndex) => {
                // Check if the cell contains the =TODAY() function
                if (cell === '=TODAY()') {
                    // Refresh the cell by setting its formula again
                    usedRange.getCell(rowIndex, colIndex).setFormula('=TODAY()');
                }
            });
        });
    }
     
    Once you save it, use the save a copy feature to save it to your OneDrive in My Files > Documents > Office Scripts as an *.osts file. You can then use the action Run script from SharePoint library to call the file and run it. See https://learn.microsoft.com/en-us/office/dev/scripts/develop/power-automate-integration?tabs=run-script#excel-connector for more details.

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard