Excel Report Automation: Refresh a Pivot, a Query, or a Macro
Put the rows in an Excel table (Ctrl+T), build a PivotTable on it, and choose Data, Refresh All when the rows change. Power Query repeats a cleanup from a CSV or another workbook. A macro repeats clicks in desktop Excel. Excel for the web does not run VBA.
Refresh a PivotTable that reads a table
Put the source in an Excel table so new rows are part of the source. Click the range and press Ctrl+T on Windows, or Control+T on a Mac. Confirm that the table has headers.
- Click inside the table. On the Insert tab, choose PivotTable, and put the pivot on a new sheet.
- Drag the fields you want into Rows, Columns, and Values. A sum of amount by region is a typical monthly report.
- When the table has new rows, click the pivot and choose PivotTable Analyze, Refresh. Or choose Data, Refresh All, which also refreshes queries in the same workbook.
A pivot does not see rows that sit outside the table. If you typed below the table without expanding it, Refresh will not include those rows. A chart built from the pivot updates when the pivot refreshes. The chart does not have its own copy of the numbers.
Refresh a query instead of pasting the export
In Excel for Microsoft 365, use Power Query when the report starts from a CSV or from another workbook.
- On the Data tab, choose Get Data, From File, then From Text/CSV or From Workbook.
- Keep the columns the report needs, set the types, and choose Close & Load.
- Build the PivotTable on that loaded table.
- Next month, replace or update the source file, then choose Data, Refresh All.
The query repeats the cleanup. It does not open by itself on a closed desktop file. Someone, or another process that opens the workbook, has to run Refresh.
Repeat the same desktop steps with a macro
A macro fits a report you rebuild with the same clicks in desktop Excel.
- Go to File, Options, Customize Ribbon, and check Developer.
- On the Developer tab, choose Record Macro, give it a name with no spaces, and start.
- Refresh the data and set the print area, or whatever the report needs, then choose Stop Recording.
- Next time, choose Developer, Macros, then Run.
Excel for the web does not run VBA macros. A recorded macro follows the sheets and the columns as they were during recording. Record it again when that layout changes.
Run a script in Excel for the web
Office Scripts are a separate path. Save the workbook to OneDrive or SharePoint and open it in Excel for the web. A Microsoft 365 business or education plan shows an Automate tab. Choose Automate, New Script, record or write the steps, and run it.
A Power Automate flow can run that script on a schedule through the Excel Online (Business) connector. Microsoft requires a business Microsoft 365 license for that connector, and the workbook has to be in the cloud. A file that exists only on the desktop is out of reach.
One option: ask Elyx in the open file
Elyx is an AI agent inside Excel. You can ask it to build the pivot of sales by region and the chart next to it. Elyx does the work in the open workbook. It does not refresh a closed file on a schedule. The trial lasts 7 days and does not ask for a card. Then Plus is €12/month and Pro is €29/month. There is no permanent free plan.
Start the 7-day free trial, no credit card.
Direct answers
How do you automate an Excel report?
Store the source as a table, build the PivotTable from that table, and refresh it. Data, Refresh All also refreshes Power Query loads in the workbook.
Why did Refresh miss the new rows?
Those rows are outside the table or outside the range the pivot was built on. Add them inside the table, then refresh again.
Can a macro refresh a report in Excel for the web?
No. Excel for the web does not run VBA. An Office Script on a cloud workbook is the web path, and it needs a Microsoft 365 business or education plan.
Ask Elyx in Excel: "Build a pivot of sales by region and a chart from it." Elyx does it in the workbook. 7-day trial, no card.
Start the 7-day trial