VBA & Macro Problems

How to Append Refreshed Excel Web Data Instead of Overwriting

Rana GarciaRana Garcia Nov 3, 2026 869 views

Question details

The user wants to keep a continuous historical record of web query data by appending new data to a worksheet automatically upon refresh, rather than letting the application overwrite the existing data.

How to Append Refreshed Excel Web Data Instead of Overwriting It
Product
Excel
Device & OS
not provided
Scenario
Collecting historical data from a web query that refreshes automatically at set intervals.
Observed behavior
Refreshing a web query inherently replaces the previous results in the destination range, preventing the user from maintaining a historical log of the data intervals.
Before you start

Ensure your workbook is saved as a Macro-Enabled Workbook (.xlsm) to allow VBA scripts to run. Additionally, estimate your data volume beforehand, as high-frequency refreshes can quickly generate hundreds of thousands of rows and significantly slow down your file.

Solution 1Recommended

Use a VBA Macro to Append Refreshed Data to a History Sheet

Create a VBA script that triggers after the web query refreshes to copy the newly fetched data and paste it at the bottom of a dedicated historical tracking worksheet.

The default behavior of a web query is to overwrite the specified destination range to display the most current data. To bypass this and create a historical log, you need a VBA macro that acts as an automated bridge, taking the freshly pulled data and appending it to a separate 'History' worksheet.

Warning: Closely monitor your row count and refresh frequency. For example, refreshing 100 rows every minute for 16 hours yields about 96,000 rows a day. This massive data accumulation can cause severe performance issues over time.

1
Set Up Your Worksheets

Create two separate sheets in your workbook: name one 'WebData' (where your query actually refreshes) and another 'History' (to store the appended historical records).

2
Open the VBA Editor

Press 'ALT + F11' on your keyboard to open the Visual Basic for Applications (VBA) editor.

3
Insert a Custom Macro

Click 'Insert' > 'Module' in the top menu. Write or paste a VBA script designed to copy the used range from the 'WebData' sheet and paste it to the first empty row (using a method like 'End(xlUp).Row + 1') in the 'History' sheet.

4
Automate the Script

To prevent doing this manually, use the 'Worksheet_Change' event on the 'WebData' sheet or the 'Application.OnTime' method to automatically run your appending macro every time the web query finishes refreshing.

Use a VBA Macro to Append Refreshed Data to a History Sheet
Manage Data Size Proactively: If you are collecting data continuously, consider archiving old data to a separate file, CSV, or a dedicated database program (like Access) on a weekly basis to keep your primary workbook lightweight and responsive.
Advanced Data Handling with WPS Office

Manage and Append Web Data Seamlessly in WPS Spreadsheet

WPS Spreadsheet offers robust support for VBA macros and external data queries, allowing you to easily automate data collection and append historical records efficiently in a highly optimized, lightweight environment.

  1. 1. Open Your Macro-Enabled File: Launch WPS Spreadsheet and open your .xlsm file containing the web query and your custom append macro.
  2. 2. Enable Macros: Navigate to the 'Developer' tab on the ribbon and click 'Enable Macros' if prompted by the document security warning.
  3. 3. Run or Automate the Append Script: Use the 'Macros' button in the Developer tab to execute your script manually, or let your automated VBA triggers handle the task seamlessly as the web data refreshes.
Full compatibility with Microsoft Excel VBA (.xlsm) files and macro scripts.Lightweight software architecture that handles large datasets and high row counts efficiently.Built-in developer tools for editing, debugging, and running data-appending macros.Completely free to use with a familiar interface for a seamless transition from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel overwrite my web query data when it refreshes?

By default, web queries are designed to pull the most current state of the web data into a specific target range. To prevent the spreadsheet from becoming cluttered or misaligned, the application clears the old data in that specific range before inserting the updated information.

How do I find the last empty row using VBA to append data?

In VBA, you can find the last used row in a specific column by using a command like 'Cells(Rows.Count, 1).End(xlUp).Row'. Adding 1 to this resulting value gives you the exact row number of the first empty row where new data can be safely pasted.

Can I append historical web data without using VBA macros?

Standard web queries require VBA to append data automatically to a history log. While advanced users can utilize Power Query to pull and append data, maintaining a continuous, automated historical log of live-refreshing intervals almost always requires VBA or external database integration.

What happens if my file gets too large from appended data?

If your workbook accumulates hundreds of thousands of rows due to frequent refreshes, tasks like saving, calculating formulas, and opening the file will become significantly slower. It is highly recommended to periodically export this data to a CSV file or move it to a database.