Skip to main content
Version: 2027 R1

Generate an Excel file

The action generates a new .xlsx file based on a template, or updates an existing attachment of the workflow instance. The core feature of this action and its complementary action Read data from an Excel file is to assign (map) specific process form fields to cell addresses in an Excel spreadsheet.

Basic configuration​

The Basic tab of the Properties panel contains settings common to every action in an automation: the Active toggle, the Action type selection field, the Documentation field, the Use action template toggle (when enabled, the action takes its configuration from the selected action template defined in the process), the Execution condition section (determines whether the action always runs or only when a custom rule is met), and the Runtime error handling section (the message and numeric error code returned when the action fails to execute). These settings are not unique to the Generate an Excel file action, so they are described in detail in the Actions chapter.

Basic tab in the Properties panel of the Generate an Excel file action

Advanced configuration​

The Advanced tab contains fields specific to this action, grouped into sections: Save mode, Document selection, Mapping, and Output. The selected Save mode determines which additional fields and sections are available.

Advanced tab in the Properties panel of the Generate an Excel file action

1. Save mode​

The field determines what the result of the action is:

  • New attachment - one new .xlsx file is created based on the template.
  • Update of existing attachment - the indicated attachment of the workflow instance is updated instead of creating a new file.

Selecting Update of existing attachment replaces the Document selection section with the Choose attachment section — see the description below.

2. Document selection​

The section is active for the New attachment mode. It determines where the document template is retrieved from:

  • From attachment - an existing attachment of the workflow instance is used as the template.
  • From URL - the template is downloaded from the indicated URL address.
  • From document templates process - the template is retrieved from a dedicated process that stores document templates.

From attachment​

Exposes the Attachments to be processed section, in which Based on determines how the attachment acting as the template is selected:

  • Category - the attachment is selected based on its assigned category.
  • Regular expression - the attachment is selected with a regular expression matching the file name.
  • Data source - the attachment is selected with an SQL query returning a list of identifiers.

For the Category mode, two fields are available:

  • Category — the category of attachments taken into account:

    • All - attachments belonging to any category are taken into account.
    • Dynamic - once selected, the Dynamic expression field becomes available, where the category is built dynamically (using the rule editor) or entered manually, in the format ID#Name or just ID.
    • None - attachments not assigned to any category are taken into account.
  • Select — which of the matching attachments will be used as the template:

    • All attachments - all matching attachments are processed.
    • The oldest attachment - only the earliest added attachment is used.
    • The newest attachment - only the most recently added attachment is used.

For the Regular expression mode, the Regular expression field is available, built manually or with the help of the variable editor:

  • File1 or File2, example: (criterion1|criterion2)
  • File1 and not File2, example: ^(criterion1|(?!criterion2))
Usage examples
  • The simplest selection — only files with a given extension, e.g. ".xlsx":
    • Expression: .xlsx
    • Accepted: Attachment1_File.xlsx
    • Rejected: Attachment1_File.docx
  • The file name should start with an explicitly defined word (here: WEBCON), followed by an __ or - character, any number of alphanumeric characters, and end with the .xlsx extension:
    • Expression: WEBCON(_|-)[a-zA-Z0-9]*\.xlsx$
    • Accepted: WEBCON_FileName007.xlsx, WEBCON-FileName007.xlsx
    • Rejected: WEBCON FileName With spaces.xlsx, SharePoint_FileName123.xlsx
  • The file name should start with a date in YYYY-MM-DD format, followed by an __ or - character, any number of alphanumeric characters, and end with the .xlsx extension:
    • Expression: ^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])(_|-).*\.xlsx$
    • Accepted: 2015-07-09_FileName007.xlsx, 2015-07-09-File123_New.xlsx
    • Rejected: 2015/07/09-NotGonnaWork.xlsx, WEBCON_2015-07-09_File.xlsx
  • Words in the file name should be separated by a - character and end with the .xlsx extension:
    • Expression: ^[a-zA-Z0-9]+(?:-[A-Za-z0-9]+)*\.xlsx$
    • Accepted: WEBCON-File-New.xlsx
    • Rejected: WEBCON_File_Old.docx

For the Data source mode, the SQL query field is available, in which a query returning a list of attachment identifiers should be provided.

Example
Select [ATT_ID] from [WFDataAttachmets] where [ATT_Name] = 'file.xlsx'

From URL​

Exposes the Document link field, in which the URL address where the template is available should be provided (e.g. http://intranet/workflow/documents/template.xlsx). Any link allowing to download a document with anonymous access can be used.

From document templates process​

Exposes the Document template section with two methods of indicating the template:

  • Template source - the template is indicated by selecting a data source, then a specific template from a list.
  • Dynamically calculated - the template is indicated by an identifier built dynamically (using the rule editor) in the format /DOCTEMP/<template_identifier>/<instance_identifier>. The ID is a value in the following format: /DOCTEMP/GUID/filename, where:
    • DOCTEMP – a fixed name specifying document templates process,
    • GUID – a template ID from an ID field available in the process form,
    • filename – an optional file name.
Example
/DOCTEMP/ec3b6447-417c-4250-ba7b-0534fdacdd2c/template.xlsx
/DOCTEMP/ec3b6447-417c-4250-ba7b-0534fdacdd2c

Choose attachment​

The section is visible only for the Update of existing attachment mode — it replaces the Document selection section. It has an identical structure to the Attachments to be processed section described above (Based on: Category / Regular expression / Data source, together with the Category and Select fields and the same regular expression patterns), with the difference that it indicates the attachment to be updated, not a template.

3. Mapping​

The section allows linking selected form fields to cells in the Excel worksheet. Each row, added with the Add row button, contains two fields:

  • Form field - the name of the form field which will be mapped to a cell/cells in the Excel file.
  • Excel address - the cell address or table name, formatted as <sheet name>!<address>.
Examples

To select cell A1 enter: Sheet1!A1 To select table Table1 enter: Sheet1!Table1

caution

"Data row" columns in the item list are not supported when generating or reading an Excel file.

4. Output​

The section allows configuring the parameters of the resulting file. The availability of individual fields depends on the selected Save mode:

  • File name - available for the New attachment mode. The name of the resulting file, built dynamically with the rule editor.

    Example
    File_{WFD_Signature}
  • File description - available for the New attachment mode. An optional description of the resulting file, built dynamically with the rule editor.

  • Category - available for the New attachment mode. The category the resulting file is saved to:

    • None - the resulting file is saved without a category.
    • Dynamic - once selected, the Dynamic field becomes available, where the category is built dynamically (using the rule editor) or entered manually, in the format ID#Name or just ID.
  • Overwrite attachment with the same name - available for every save mode. If checked, a file with the same name is overwritten while its existing category is kept — a new historical version of the file is created.

tip

If the Overwrite attachment with the same name option is not checked and a file with the same name already exists among the attachments, both versions of the file will be available in the Attachments menu after the new file is generated.