You are viewing limited content. For full access, please sign in.

Question

Question

workflow export to excel

asked on December 10, 2020

Hello,

 

What is the best way to export a query from SQL to Excel using workflow. Here's what I'm looking to do. 

 

User completes a form that identifies query parameters

Workflow uses these filters and runs a query from the SQL database

I would like this this query to export to Excel for the user completing the form. 

 

Thanks! 

0 0

Replies

replied on December 10, 2020

This is what I usually do,

I create two Excel files on the Workflow server; one for holding the data and another as an empty template:

  • FileName
  • FileName_Template

 

On the server I create and ODBC entry for the FileName copy, and then set that up as a data source for the workflow server.

Next, I create a placeholder document in my repository for the "report" in hidden folders we use for  process-specific things like that.

In the Workflow, I run the query first to collect the data, then I run a short Script activity that overwrites the "FileName" copy with the blank template to clear out any old data.

Next, I use a for each row activity and insert data to populate the excel file with the data from the query, then I attach the updated excel file to the "placeholder" entry in the repository.

Once that's done, I email file to the user by retrieving it from the repository entry.

 

The main limitation to this approach is that Excel files can only be accessed by one process at a time so this won't work if multiple workflows can potentially run on the same file in parallel.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.