--- title: "Pre-load Data Processing Script" slug: "pre-processing" description: "Run a SQL query just before data loads, triggered by a Tree Filter selection or Refresh, for example to pre-fill a forecast the user then edits." updated: 2025-01-30T14:11:37Z published: 2025-01-30T14:11:37Z canonical: "sqlspreads.com/pre-processing" --- > ## Documentation Index > Fetch the complete documentation index at: https://sqlspreads.com/docs/llms.txt > Use this file to discover all available pages before exploring further. # Pre-load Data Processing Script ## Introduction A pre-load script allows the execution of a SQL query when an end user selects a new item in a Tree Filter or clicks the Refresh button. The pre-load script is executed just before the data is loaded into the spreadsheet. Pre-loading can be used to populate tables with data based on user selections in a Tree Filter or to perform other data manipulations. The ability to pre-load data into your SQL Server table is beneficial in use cases such as forecasting to pre-load a table with a proposal that the user can edit. ## How to add a pre-load script These are the steps you need to follow to add a pre-load script into your SQL Spreads solution: 1. Click the Data Processing button in the SQL Spreads tab. ![Data Processing button in the SQL Spreads ribbon](https://cdn.document360.io/ad9d65b3-9cdd-4b28-8cb8-86cb149873bc/Images/Documentation/Data%20Processing%20button.PNG) 2. Enter a name for your new script. ![New Script name field for Data Processing](https://cdn.document360.io/ad9d65b3-9cdd-4b28-8cb8-86cb149873bc/Images/Documentation/Data%20Processing%20Script%20Name%20field.PNG) 3. Set the timing for the script execution to "Before data loads from SQL Server." ![image.png](https://cdn.document360.io/ad9d65b3-9cdd-4b28-8cb8-86cb149873bc/Images/Documentation/image%28254%29.png) 4. Enter your SQL query. ![Enter SQL query dialog](https://cdn.document360.io/ad9d65b3-9cdd-4b28-8cb8-86cb149873bc/Images/Documentation/Enter%20SQL%20Query%20field.PNG) 5. Click OK.