How to Automate Report Generation in Excel

Cody Schneider9 min read

Manually building the same Excel report week after week is a classic time-waster. You export the latest data, copy and paste it into a spreadsheet, wrestle with formulas and charts, and then do it all again next Monday. This article will show you how to automate that entire process in Excel, turning hours of repetitive work into a task that takes just a few clicks.

GraphedGraphed

Your AI Data Analyst to Create Live Dashboards

Connect your data sources and let AI build beautiful, real-time dashboards for you in seconds.

Watch Graphed demo video

The Foundation: Structure Your Data for Automation

Before you automate anything, your data needs to be in a clean, machine-readable format. Automation tools in Excel thrive on structure and get tripped up by messy, disorganized data. Your goal is to format your data as a simple, flat table.

Follow these fundamental rules:

  • One Header Row: Your table should have a single header row at the very top. Don't use multiple rows for headers.
  • Descriptive Headers: Each column header should be unique and clearly describe the data in that column (e.g., "Sale Date," "Product Category," "Revenue").
  • No Empty Columns or Rows: There should be no completely blank columns or rows cutting through the middle of your dataset.
  • No Merged Cells: Merged cells are a disaster for data analysis. Keep your data in a simple grid with one piece of information per cell.

Pro Tip: Use Excel Tables (Ctrl + T)

Once your data is cleaned up, the single most important step you can take is to format it as an official Excel Table. This isn't just about cell borders and colors, it's a powerful feature that makes your data range dynamic.

Here’s how:

  1. Click anywhere inside your clean data range.
  2. Go to the Insert tab and click Table, or just press the shortcut Ctrl + T.
  3. Ensure the "My table has headers" box is checked, and click OK.

Now, when you add new rows or columns of data, the Table automatically expands. Any formulas, PivotTables, or charts referencing this Table will automatically include the new data when you refresh them. This single step removes the need to constantly update your report's data source ranges, which is a massive win for automation.

Free PDF Guide

AI for Data Analysis Crash Course

Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.

Automate Data Importing and Cleaning with Power Query

Power Query is Excel's built-in data transformation engine, and it’s the heart of report automation. It lets you connect to almost any data source (other Excel files, CSVs, entire folders, web pages, databases) and create a repeatable sequence of steps to clean and reshape your data before it even lands in your worksheet.

Anything you do in the Power Query Editor is recorded as a step. When you get new data, you don't repeat the steps, you just click "Refresh," and Power Query runs through the recorded sequence for you.

Example: Automating a Report from a Folder of Monthly CSV Exports

Let's imagine you get a separate CSV export of your sales data every month. Instead of manually copying and pasting them together, you can have Power Query do it for you automatically.

Step 1: Connect to the Folder

  1. Go to the Data tab in Excel.
  2. In the "Get & Transform Data" section, click Get Data > From Folder.
  3. Browse to the folder where you save all your monthly CSV exports and click Open.

Step 2: Combine and Transform the Files

  1. Excel will show you a list of the files in that folder. Click the Combine & Transform Data button at the bottom.
  2. A new window will show you a sample of the first file. Excel will use this file to figure out how to structure the data. Usually, you can just click OK here.
  3. This opens the Power Query Editor. You'll now see the data from all the CSV files in your folder stacked on top of each other.

Step 3: Clean the Data

Now you can perform your cleaning steps. For example:

  • Remove unnecessary columns: Right-click the header of a column you don't need and select Remove.
  • Change data types: The "Order Date" column might be imported as text. Click the icon on the column header (e.g., "ABC") and change it to Date. Do the same for numbers.
  • Filter out rows: Click the dropdown arrow on a header to filter the data, just like in Excel. For instance, you could filter out returned orders if there's a "Status" column.
  • Split columns: If you have a column with a customer's full name, you can select it and go to Transform > Split Column > By Delimiter to separate the first and last names.

Every action you take appears in the "Applied Steps" pane on the right. This is your recorded automation recipe!

Step 4: Load the Data into Excel

  1. Once you're happy with your data, click the Close & Load button in the top-left corner.
  2. Power Query will load the clean, consolidated data into a new worksheet as an Excel Table.

The magic happens next month. When you drop your new monthly CSV into the folder and open your Excel report, just go to the Data tab and click Refresh All. Power Query will automatically grab the new file, apply all your cleaning steps, and add the new data to your results table in seconds.

GraphedGraphed

Your AI Data Analyst to Create Live Dashboards

Connect your data sources and let AI build beautiful, real-time dashboards for you in seconds.

Watch Graphed demo video

Build a Dynamic Report with PivotTables and Slicers

Now that your data loading is automated, you can build a report on top of it that also updates automatically. PivotTables are the perfect tool for summarizing information.

Step 1: Create a PivotTable

  1. Click anywhere inside the green results table that Power Query created.
  2. Go to the Insert tab and click PivotTable.
  3. Leave the default settings and click OK. This will create a PivotTable in a new worksheet.

Your PivotTable is connected to your Power Query result. This means whenever you refresh your query, your PivotTable will be able to see that new data after a quick refresh.

Step 2: Design Your Summary Report

Use the "PivotTable Fields" pane on the right to build your report. For a sales report, you might:

  • Drag Product Category into the Rows area.
  • Drag Order Date into the Columns area (Excel will automatically group this by months and years).
  • Drag Revenue into the Values area (it will automatically be summed up).

Just like that, you have a summary table showing revenue by category across time, without writing a single formula.

Step 3: Add Interactive Controls (Slicers)

Slicers are user-friendly buttons that filter your PivotTable.

  1. Click inside your PivotTable to show the PivotTable Analyze tab at the top.
  2. Click on Insert Slicer.
  3. Check the boxes for the fields you want to filter by, like "Region" or "Sales Rep." Click OK.

You’ll now have floating filter panels. Clicking "North" on the Region slicer will instantly update your PivotTable to show data for only that region.

Combine Everything on a Dashboard

A good report is easy to understand. You can consolidate your visuals onto a single "dashboard" sheet for at-a-glance analysis.

Step 1: Create PivotCharts

A PivotChart is just a chart that is linked to a PivotTable.

  1. Click on the PivotTable you created.
  2. On the PivotTable Analyze tab, click PivotChart.
  3. Choose a chart type, like a Line or Bar chart, and click OK.

Step 2: Assemble Your Dashboard

  1. Create a new, blank worksheet and name it "Dashboard".
  2. Go to your PivotTable sheet, select your PivotChart, press Ctrl + X to cut it.
  3. Go to your Dashboard sheet and press Ctrl + V to paste it.
  4. Do the same for your Slicers.
  5. Resize and arrange the charts and slicers to create a clean, organized layout.

Now, when you use the Slicers on your dashboard, the charts will update instantly. This gives you a fully interactive report that you and your team can use to explore the data without needing to dig into the raw numbers.

Free PDF Guide

AI for Data Analysis Crash Course

Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.

Using the Macro Recorder for Formatting

For one final touch, you can use a simple Macro to automate repetitive formatting tasks.

The Macro Recorder works by recording your mouse clicks and keystrokes and converting them into code you can replay later. It’s perfect for simple tasks and style adjustments you make every time.

How to Record a Formatting Macro:

  1. Have the Developer tab enabled. (If you don’t see it, go to File > Options > Customize Ribbon and check the box for "Developer").
  2. Click on your main data tab generated by Power Query.
  3. On the Developer tab, click Record Macro.
  4. Give your macro a short, descriptive name (e.g., "ApplyFormatting") and click OK.
  5. Now, perform the formatting you do every time. For instance, adjust the column width for a few columns, or change the number format for your revenue column to "Currency".
  6. When you are finished, go back to the Developer tab and click Stop Recording.

To run it in the future, just go to Developer > Macros, select your macro, and hit Run. After refreshing your report, you can run this macro to instantly apply your preferred formatting.

Final Thoughts

By structuring your data correctly, using Power Query to automate data import and cleaning, and building reports with PivotTables, you can transform your manual reporting process. That time-consuming task of exporting, copying, and shaping data is replaced by a simple click of the "Refresh All" button, giving you an always-updated, interactive dashboard.

While mastering Excel automation is a powerful skill, it requires setup time and a learning curve. Our goal with Graphed is to eliminate this entire manual process. Instead of building data pipelines and wrestling with PivotTables, we connect directly to your data sources like Google Analytics, Shopify, or Facebook Ads. Then, you simply ask in plain English for what you want to see - like "Show me a dashboard of ad spend vs revenue by campaign" - and we build a real-time, shareable dashboard for you instantly. The goal is to get you from data to decision in seconds, not hours.

Related Articles