Data
Saved queries that refresh into tables
Open a saved query in Queries & Connections, change one of its steps, and refresh: the output tables on the sheet follow. New orders reach them only through a refresh.
Package @sheetwrite/queries
- Orders in the feed
- 2,000
- Saved queries
- 3
Try it
- Remove the Filter rows step, then Save
What a refresh does
- The session loads sources only through your
fetchSourcecallback, so your app applies its own credentials and network rules. - Undo and redo restore the written values without another source load: watch Source loads stay the same.
- Large orders keeps orders of $1,500 or more. A refresh that would grow a table over other cells writes nothing.
- XLSX export writes the saved queries as Power Query parts for Excel, and import reads them back, once the Power Query codec is loaded: the queries add-on loads it, or call
loadPowerQueryCodec(). See Power Query in XLSX.
Undo and redo restore the written values with no new source load.
The code behind it
import "@sheetwrite/core/styles.css";
// A workbook with an empty "report" sheet for the query's output table
// The only path to source data: the host loads it, with its own credentials. }, }), ],});// The grid fills its host, so the host needs a heightconst host = document.querySelector<HTMLElement>("#grid");if (host === null) throw new Error("Missing #grid host");host.style.height = "480px";
// The region list, from JSON such as [{ "code": "EU", "regionName": "EMEA" }].// It has no output table: it only feeds the query below. ], },});
// Orders from a CSV feed: keep shipped ones, add each region's name from the// region list, and total them by region name. ], }, { ], }, ], },});
// Every output table in one transaction, or none if a query fails.
// When the page removes the host: session.dispose(); grid.destroy();