Course contents6 lessons
Course overview
  1. Queries Basics
  2. Displaying the Results of Queries
  3. Binding Query Results to Named Ranges
  4. Using Query Results in Calculations
  5. 05Decoupling Data from a Spreadsheet Using Queries
  6. 06Query Triggers

Lesson 5 of 6

Decoupling Data from a Spreadsheet Using Queries

Move large lookup tables out of Excel, import them as SpreadsheetWeb data maps, query by input values, and bind the result back into calculations.

2 min read

Large lookup tables can make an Excel model difficult to maintain and increase the size and calculation time of the application. The Queries module lets you store that data separately, retrieve only the matching value, and bind it back to a named range used by the workbook.

Move the lookup data out of Excel

Copy the large reference table into a CSV file and import it into SpreadsheetWeb as a data map. Review the imported columns and data types so the fields used for matching are consistent with the workbook inputs.

After the external data is available, remove the lookup table from the workbook. Also remove or revise formulas that still refer directly to the deleted range. Keep or create a named range for the value that the query will return to the calculation model.

Create the application and query

Create or update the application with the streamlined workbook. In the workflow demonstrated in the video, the application uses a database and has at least one saved record before its data is used through Queries.

Create a query against the imported data map. Select the output column needed by the workbook, then add a condition that compares the appropriate data-map field with the application's input value. If the workbook expects one scalar value, enable Select Top 1 and ensure the condition identifies a unique or intentionally prioritized row.

Bind the result back to the calculation

Bind the query result to the workbook named range that replaces the original lookup formula. In the example, the returned value supplies an area factor used by the rest of the spreadsheet calculation.

Preview the application with several input values and compare the results with the original workbook. Test a missing match and any duplicate keys as well as normal cases. Decide how the model should behave when the query returns no row, and add validation or a fallback value if an empty result would make downstream formulas unreliable.

This pattern keeps the calculation workbook smaller while allowing the reference data to be updated and queried independently of the Excel file.