Transformations in Kettle run asynchronously, so you're probably looking into needing a job for this.
Files to create
- Create a transformation that performs the SQL query you're looking for and populates a variable based on the result
- Create a transformation that pulls data from the Excel file, using the variable populated as the filename
- Create a job that executes the first transformation, then steps into the second transformation
Jobs run sequentially, so it will execute the first transformation, perform the query, get the result, and set a variable. Variables need to be set and retrieved in different transformations because of their asynchronous nature. This is the reason for the second transformation; the job won't step into the second transformation until the first one is done running (therefore, not until the variable is populated).
This is all assuming you only want to run the transformation once, expecting a single result from the query. If you want to loop it, pulling data from a set, then setup is a little bit different.