# How to generate an Excel file from a form’s gridview

**URL:** <https://discuss.workflowgen.com/t/how-to-generate-an-excel-file-from-a-form-s-gridview/298>\
**Category:** Form Designer\
**Created:** [June 10, 2016, 8:30pm UTC](https://discuss.workflowgen.com/t/how-to-generate-an-excel-file-from-a-form-s-gridview/298 "2016-06-10T20:30:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [June 10, 2016, 8:30pm UTC](https://discuss.workflowgen.com/t/how-to-generate-an-excel-file-from-a-form-s-gridview/298/1 "2016-06-10T20:30:09Z")

</div>

You can easily integrate document generation into a workflow. This article provides an example of how to use the EPPlus library to generate an Excel file from a form’s gridview, such as the Investment Application process (template) form grid.

The generated file will be available as one of the first action’s OUT parameters.

1. Download EPPlus 4.0.5 from [http://epplus.codeplex.com/releases/view/118053](http://epplus.codeplex.com/releases/view/118053).

2. Copy the EPPlus DLL to the `DRIVE:\Inetpub\YOURSITE\wfgen\WfApps\WebForms\Bin` folder.

3. Create a new WorkflowGen process with a grid, such as the Investment Application Process (template).

4. Create a `FORM_EXCEL` process data and set its data type to file. This process data will contain the generated Excel file.

5. Create a new textbox field in the same section as the grid with the ID `EXCEL`. Hide this textbox for all actions (edit the textbox settings and check **Hide checkbox for all actions** ).

6. Using the Mapping tool in the form editor, select the first action, and click the **Value OUT** button associated to this new textbox. In the existing data field, select the `FORM_EXCEL` data.

7. In the code-behind, create your new private `Gridview2Excel` method. With this method, you must save the generated file name in the “FORM\_EXCEL” process data. This is how the generated file will be accessible from the follow-up form (for more information on this topic see the [Form designer: How to generate a PDF version of the form archive](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268) topic).

8. In the code-behind `MySubmitButton_Click` method, call your `Gridview2Excel` method.

---

<div class="post-metadata">

**Author:** ![marinam](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/marinam/32/322_2.png) [@marinam](https://discuss.workflowgen.com/u/marinam)\
**Post date:** [May 23, 2018, 10:17am UTC](https://discuss.workflowgen.com/t/how-to-generate-an-excel-file-from-a-form-s-gridview/298/2 "2018-05-23T10:17:31Z")

</div>

Hello,

Is it possible to do the opposite? We would like to upload spreadsheet to WFG request that should be transferred to gridview / table in the same WFG request.  
We also would like to have separate data element for each field in the gridview.  
Does this sound possible and is there any documentation that may help us achieving this?

Thank you,  
Marina

---

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [May 23, 2018, 3:41pm UTC](https://discuss.workflowgen.com/t/how-to-generate-an-excel-file-from-a-form-s-gridview/298/3 "2018-05-23T15:41:22Z")

</div>

Hi Marina,

Yes, this is possible but there is no documentation regarding this.

What can be done is the following:

1. Create a C# library that retrieves the file (using GraphQL for example), read through the Excel sheet and returns a DataSource object.
2. Copy the DLL file of this class into `wfgen\webapps\webforms\bin`
3. You can use this class in the .NET code behind editor to send the Excel file, retrieve the DataSource object and bind it to the Gridview.

If you want assistance regarding the implementation of this solution, feel free to open a ticket in our Helpdesk site.

Regards,  
Eddy.
