Read data from sql server export to excel with each client on new tab

Hi,

I am learning EasyMorph. I have a task to take results from a SQL server stored procedure, export the results into excel showing a seperate tab for each ClientID. I was using Iterate and it was working but I was putting all the data into a excel spreadsheet in the main data pull, then iterating through the client ID and creating a seperate tab for each Client ID. This worked great, but the request does not want all the data on the first tab. So I used the Excel (experimental) action to delete the sheet1 with all the clients on it. This worked great, but then when I deployed it to the EasyMorph Server, the Delete tab was not working. I now have it working but I had to hard code the clientID and derrive a table for each clientID then write to excel in each derrived table using synchronize.

I like the way the itteration was working because it was dynamic and didn’t matter how many clientID’s I have. Is there a way to use the itteration without writting a table before the itteration part starts? I will attach some sample data for the sql pull and sample data for results. Please advise on the best approach for this. We want to schedule this through EasyMorph server once it’s working correctly.

Any advice for a newbie is greatly appreciated.

Required Output.xlsx (10.4 KB) SQL Server data pull.xlsx (8.9 KB)

Hi @EasyMorphNewbie and welcome to the Community!

Using “Excel command” on EasyMorph Server requires a bit of configuration of Windows on the machine that runs the Server, but the action isn’t really needed in your case.

Instead, create a new spreadsheet for the 1st client before iterations, then iterate across the remaining clients and insert a new sheet into the existing spreadsheet in each iteration.

See an example with your data below:

split-sql-pull.morph (7.7 KB)

dgudkov,

Thank you for sharing. I like the Enumerate Group by Client ID, that was a great way to handle creating the first table, and then using that again to only grab the remaining client ID’s. I will apply this to my version and keep it in my notes. Thanks again.

You’re welcome! :slight_smile: