Generating Excel Document in a!localVariables

Hello,

Is it possible to generate an excel file using a!exportDataStoreEntityToExcel in a!localVariables ? The Appian Documentation states that - "The Write to Data Store Entity smart service is available as an expression function that can be executed inside a saveInto on a component or as part of a Web API ". I am just wondering if this smart service can be executed as part of a!localVariables and generate an excel document for downloading. 

Here is the sample code snippet that I am currently working on.

Thanks,
Sidd

a!localVariables(
  local!excelgeneration: a!refreshVariable(
    value: a!exportDataStoreEntityToExcel(
      entity: cons!ABC_entity,
      selection: a!querySelection(
        columns: {
          a!queryColumn(
            field: "field_1"
          ),
		  a!queryColumn(
            field: "field_2"
          ),
          .
		  .
		  .
        }
      ),
      filters: a!queryLogicalExpression(
        operator: "AND",
        filters: {
          a!queryFilter(
            field: "field_1",
            operator: "=",
            value: local!filter_1
          ),
          a!queryFilter(
            field: "field_2",
            operator: "=",
            value: local!filter_2
		  ),
		  .
		  .
		  .
       
        },
        ignoreFiltersWithEmptyValues: true
      ),
      documentName: "Excel Document",
      saveInFolder: cons!SAMPLE_FOLDER,
      onSuccess: a!save(
        ri!generatedExcel,
        fv!newDocument
      )
    ),
    refreshAlways: true()
  ),
  {
    a!richTextDisplayField(
      value: {
        a!richTextItem(
          text: {
            char(
              13
            ),
            a!richTextIcon(
              icon: "download"
            ),
            " Download Excel File"
          },
          link: a!documentDownloadLink(
            label: "Download Excel File",
            document: ri!generatedExcel
          ),
          linkStyle: "STANDALONE"
        )
      },
      align: "LEFT"
    )
  }
)

  Discussion posts and replies are publicly visible