How I Made Excel Do My Work: Achieve the Zero Click Dream

Aug 21, 2025 • 8 min read

Whenever we work with Excel, there is one question worth asking: Can we turn this into a zero-click dream?

Not a process where we open a workbook, refresh a report, and press a button. A process that runs in the background without us doing anything at all. Our PC does not even need to be on.

Here is the task we are going to automate. We have a schedule of contracts and their expiry dates. Every Monday, we want to check that schedule and email ourselves a report if any contracts need attention within the next 30 days. If there is nothing to report, we do not want an email.

We will build this with Excel formulas, three small Office Scripts, and a scheduled Power Automate cloud flow. There is some setup, of course. But once that is complete, the weekly task requires zero clicks.

What You'll Learn

  • Build a dynamic contract expiry report and a numeric switch that controls email notifications.
  • Create reusable Office Scripts to update cells, read values, and capture report images.
  • Schedule a cloud flow that emails the report only when matching contracts exist.
  • Use a spill-range reference to capture the complete report as its size changes.

What we need before we start

The workbook for this process is saved in SharePoint. That gives our cloud flow a location from which to access it and run the scripts.

To follow along, we need:

  • An Excel workbook containing a table of contracts and expiry dates.
  • Access to Office Scripts through Excel’s Automate tab.
  • Power Automate to create a scheduled cloud flow.
  • An Outlook connection for sending the notification.

Check Microsoft’s Office Scripts platform and license requirements before starting. You can also get the example workbook through our free Insiders program, using file reference 0276 Zero Click Dream.

The process has four stages: prepare the workbook, create the scripts, build the flow, and test the result.

Step 1: Set up the Excel workbook

From the SharePoint document library, open the workbook’s three-dot menu and select Open in app.

Our source table has three columns: Contract ID, Business Name, and Expiry Date. We will keep that list on the left of the worksheet and create the report to the right.

Use the following worksheet layout so the formulas and flow parameters line up:

  • Worksheet: Contracts
  • G4: the date used to calculate the reporting cutoff
  • G5: a switch that determines whether to send the email
  • F10: the starting cell for the report’s dynamic array formula

For the formulas below, name the source Excel table ContractsTable, or substitute your existing table name.

Filter the contracts using a 30-day cutoff

In cell F10, enter:

=FILTER(ContractsTable,ContractsTable[Expiry Date]<=G4+30,{"[None]","",""})

The formula returns the rows where the expiry date is less than or equal to the date in G4, plus 30 days.

The final argument handles the case where no rows match. It returns [None] in the first column and empty text in the other two columns. This gives us a consistent three-column result, even when there are no contracts to report.

To check the formula, temporarily enter August 7, 2025 in G4. Then try July 20, 2025. The returned list changes because the cutoff date changes.

Once that is working, replace the test date in G4 with:

=TODAY()

One important detail: this filter checks only the upper cutoff. It includes contracts that have already expired as well as those due by the next 30-day cutoff. It does not exclude dates earlier than today.

Add headings with VSTACK

The filtered rows need column headings, especially because we will be sending the report in an email.

Edit the formula in F10 to stack the source table’s headings above the filtered results:

=VSTACK(ContractsTable[#Headers],FILTER(ContractsTable,ContractsTable[Expiry Date]<=G4+30,{"[None]","",""}))

VSTACK combines the two arrays vertically. The first array supplies the headings, and the second supplies the matching contracts.

Make the heading row bold and add a bottom border. The first result row is now row 11, which matters for our next formula.

Create the send-email switch

In cell G5, enter:

=--(F11<>"[None]")

The comparison checks whether the first result cell contains something other than our no-results marker. On its own, that comparison returns TRUE or FALSE. The double minus converts the result to a number:

  • 1: there are matching contracts, so send the report.
  • 0: there are no matching contracts, so do not send it.

That small switch keeps the decision inside Excel. Power Automate will only need to read the result.

Excel worksheet with a contracts table on the left and a filtered contract report on the right
The workbook contains the report and the switch that controls whether an email is sent.

Step 2: Create three reusable Office Scripts

Our flow needs to do three things inside the workbook:

  1. Change a cell value to update the report.
  2. Read a cell value to check the email switch.
  3. Create an image of the report for the email body.

We will create a separate Office Script for each task. Each script accepts a worksheet name and a range address, rather than having those references fixed inside the code.

In Excel, select Automate > New Script. Expand the code editor pane if necessary, name the script, and use its save-location option to save it in SharePoint. Save all three scripts in the same SharePoint location so they are easy to select when building the flow.

Script 1: Change Cell Value

Name the first script Change Cell Value and replace the default code with:

function main(
  workbook: ExcelScript.Workbook,
  wsName: string,
  rngName: string,
  value: string
) {
  workbook.getWorksheet(wsName).getRange(rngName).setValue(value);
}

The script starts with the workbook, gets the worksheet identified by wsName, gets the range identified by rngName, and sets its value.

The three parameters after workbook are inputs that Power Automate will supply:

  • wsName is the worksheet name.
  • rngName is the cell or range address.
  • value is the content to enter.

All three inputs are declared as strings. Save the script.

Script 2: Get Cell Value

Create another script named Get Cell Value:

function main(
  workbook: ExcelScript.Workbook,
  wsName: string,
  rngName: string
) {
  return workbook.getWorksheet(wsName).getRange(rngName).getValue();
}

This follows the same route to the worksheet and range. But instead of using setValue(), it uses getValue().

The return keyword sends the cell’s value back to the application that called the script. In our case, Power Automate will receive that value and use it in a condition.

Save this script in the same SharePoint location.

Script 3: Create Image

Create the final script and name it Create Image:

function main(
  workbook: ExcelScript.Workbook,
  wsName: string,
  rngName: string
) {
  let img = workbook.getWorksheet(wsName).getRange(rngName).getImage();
  let html = '<img src="data:image/png;base64,' + img + '" />';

  return html;
}

This time, getImage() captures the specified range as an image and stores its encoded contents in the img variable.

The next line inserts that image data into an HTML image element. The HTML wrapper stays the same; the image data changes to reflect the range we capture.

Finally, the script returns the HTML to Power Automate, ready to be included in the email body. Save the script alongside the other two.

That completes the Excel side of the process. We have a report, a send-or-don’t-send switch, and three small scripts to connect the workbook to our automation.

Step 3: Build the Power Automate flow

Open Power Automate from the Microsoft 365 app launcher. If it is not listed, select More apps to find it.

Our flow will follow this sequence:

  1. Run on the weekly schedule.
  2. Update the report date.
  3. Read the email switch.
  4. Check whether the result equals 1.
  5. If true, capture the report and send the email.
  6. If false, do nothing.

Create the weekly schedule

Select Create > Scheduled cloud flow. Name the flow Contract Expiry Reminder, choose its starting date and time, and set it to repeat every 1 week.

Select Monday as the only day, then click Create.

The flow starts with a Recurrence trigger. Select that trigger whenever you need to review or change the schedule.

Action 1: Update Report

Add a new step, search for script, and select the Excel action Run script from SharePoint library.

This action needs references to both the workbook and the script. Configure:

  • Workbook Location: the SharePoint site containing the workbook.
  • Workbook Library: Documents, if that is where the workbook is stored.
  • Workbook: select the contract expiry workbook using the file picker.
  • Script Location: the SharePoint site containing the scripts.
  • Script Library: the document library where the scripts were saved.
  • Script: Change Cell Value.

Once the script is selected, Power Automate displays its input parameters. Enter:

  • wsName: Contracts
  • rngName: G4
  • value: =TODAY()

Rename the action Update Report.

Why write =TODAY() into a cell that already contains it? This step enters the formula again and triggers recalculation, updating the report before we check whether it needs to be sent.

Action 2: Check If Send Email

Rather than enter all those workbook and SharePoint details again, copy the previous action. Right-click it and select Copy action, then right-click the plus icon below it and select Paste an action.

Rename the copied action Check If Send Email.

Leave the workbook and script-location settings unchanged, but select the Get Cell Value script. Set its parameters to:

  • wsName: Contracts
  • rngName: G5

This action returns the 1 or 0 from our Excel switch.

Add a condition to decide whether to continue

Add a new step and search for Condition.

In the first value box, open dynamic content using the lightning icon. Select result from the Check If Send Email action.

Set the comparison to is equal to and enter 1 as the second value.

The flow now has a True branch and a False branch. Leave the False branch empty. There is no need to send an email telling ourselves there is nothing to report.

True branch: Get Image

Copy the preceding script action and paste it inside the condition’s True branch. Rename it Get Image.

Keep the workbook and location details, select the Create Image script, and set:

  • wsName: Contracts
  • rngName: F10#

Do not miss the hash symbol. The reference F10 identifies one cell. The reference F10# identifies the entire spill range generated by the formula in that cell.

That means the captured image includes the headings and all returned contract rows, even when the report changes size.

True branch: Send the Outlook email

Below Get Image, add an Outlook Send an email action.

Enter your email address in the To field and use Contract Expiry Reminder as the subject.

Build the email body with:

  1. A heading reading Automated notification.
  2. A new line reading Contracts expiring within 30 days.
  3. The result dynamic content from the Get Image action.

That result is the HTML returned by our image script. It supplies the report image inside the notification.

Save the flow. The weekly schedule and conditional email process are now in place.

Step 4: Test the complete process

Before leaving the automation to run by itself, test it from beginning to end.

  1. Select Test in Power Automate.
  2. Choose the option to test Manually.
  3. Select Test, then Run flow.
  4. Select Done and wait for the run to finish.

With matching contracts in the report, the flow should update the workbook, read a value of 1 from G5, take the True branch, create the image, and send the email.

Power Automate flow with green success indicators on the completed actions and the True branch
The test run follows the True branch and completes the report and email actions.

The ultimate check is not just a successful flow run. Open Outlook and confirm that the Contract Expiry Reminder email has arrived with the contract report displayed in its body.

Outlook email titled Contract Expiry Reminder with an Automated Notification heading and a contract report

The no-results case is controlled by the same logic: Excel returns [None], G5 evaluates to 0, and the condition takes the empty False branch.

The zero-click dream is a complete process

We have not just made a report quicker to produce. We have removed the recurring task of producing and sending it.

Excel handles the reporting logic. Office Scripts updates the workbook, reads the decision, and captures the result. Power Automate supplies the schedule and sends the notification only when there is something that needs attention.

Every Monday, that process runs in the background without opening Excel or pressing a button. That is the zero-click dream: an automated report that brings significant events to us, so we can focus on taking action.

For more ways to automate your Excel work, our Excel Academy includes dedicated Office Scripts training alongside courses on Power Query, Power Pivot, and dynamic arrays.

Share

Excel Off The Grid

I help you reduce repetitive Excel work with practical guides to formulas, Power Query, reporting, and automation.

© 2026 Excel Off The Grid
Powered by Convella