Home Docs Changelog Download Pricing Customer Portal Contact

Adding Query Results Dynamically as Series in an Excel Chart

1. Overview

Q: I have an annual statistics table. The number of rows in the table is uncertain; it may range from 2020 to 2023, or from 2020 to 2025. Now I want to add a chart to this table to display the yearly data. How can I dynamically add data rows to the chart?

Table data generated by SQL query

Table data generated by SQL query

The chart effect we want to achieve (dynamically add a series to the chart for each data row)

The chart effect I want to achieve (dynamically add a series to the chart for each data row)

A: SQLMessenger version 2.4 provides the function of "Adding queried data rows to the chart". You can use this function to dynamically add data to the chart.

Note: This function requires Microsoft Office (2010 or above) to be installed on your computer.

Tips: We have configured a demo task according to your description, and you can see the running effect of the task through this demo task. Click here to download the configuration file of the demo task. Click here to learn how to use the downloaded task configuration file.

2. Configuration Steps

2.1 Design an Excel template. When designing the template, create a "Named Range" on the cell area to be filled. In this example, create a range named "SalesStatTable".

Create a named range in the table

Create a named range in the table

Step 1: Select cells A2 to M2 in Sheet1, and press the Ctrl+F3 shortcut to open the Name Manager.

Select cells A2 to M2 in Sheet1, and press the Ctrl+F3 shortcut to open the Name Manager

Step 2: Click New.

Click 'New' in the Name Manager

Step 3: Enter a name for the named range, then click OK.

Enter a name for the named range

Reference Document:

SQLMessenger User Manual - Using Custom Excel Templates

2.2 Add a chart to the template file. And add a series to the chart. In this example, the range of the series name is "=Sheet1!$A$2", and the range of the series values is "=Sheet1!$B$2:$M$2".

Add a chart to the template file

Add a chart to the template file

Reference Document:

SQLMessenger User Manual - Using "Named Range" for the Data Source in Charts

2.3 In SQLMessenger, create an attachment template, and import the template designed in the previous step into the system. Then add a query statement to the template.

When setting the query statement, note that you need to select the Named Range created in step 1 in the "Named Range" option.

Select the corresponding named range for the SQL query

Select the corresponding "Named Range" for the SQL query

In addition, you also need to check the "Append as series at runtime" option in the "Other Options" of the SQL statement, and select the chart to be updated.

Check the 'Append as series at runtime' option

Check the "Append as series at runtime" option and select the chart to be updated

Reference Document:

SQLMessenger User Manual - Using SQL Query in Templates

After completing the above settings, run the task. At this time, the system will automatically add the data rows queried by the SQL statement to the specified chart.

Statistical data from 2020 to 2022

Execution Result 1: Statistical data from 2020 to 2022

Statistical data from 2020 to 2025

Execution Result 2: Statistical data from 2020 to 2025

Reference Documents:

SQLMessenger User Manual - Using SQL Query in Templates

SQLMessenger User Manual - Using Custom Excel Templates

SQLMessenger User Manual - Using "Named Range" for the Data Source in Charts

Last updated on March 23, 2026


Cookie Settings

We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies in accordance with our Cookie Policy.

You can change your preferences at any time by clicking on "Cookie Settings" in the website footer.

Cookie Preferences

Manage your cookie preferences. You can enable or disable different types of cookies below. Necessary cookies cannot be disabled as they are required for the website to function properly.

Necessary Cookies

Always active

These cookies are essential for the website to function and cannot be switched off. They are usually only set in response to actions made by you such as setting your privacy preferences, logging in or filling in forms.

Preferences Cookies

Makes the site easier to use

These cookies allow the website to remember choices you make and provide enhanced, more personal features.

Analytics Cookies

Helps us improve our website

These cookies help us understand how visitors interact with our website, which helps us improve our products and services.

Marketing Cookies

Used to track visitors across websites

These cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging.

Leave us a message.