Getting Errors from Multiple executions of OneDrive

I am trying to post the result of a query on a worksheet in to new excel file.

I intended for OneDrive to create a file from a template only if there are results from the worksheet query.

  1. Search Worksheet for rows with filter
  2. If found, create file from template
  3. Append results in 1 into the file created in 2.

The error i have now is when there are multiple rows in 1.
One drive will create a new file with every result found.
How do i avoid multiple runs of OneDrive?