Skip to main content
May 18, 2021
Question

Export excel with header i one column and value in Next

  • May 18, 2021
  • 1 reply
  • 0 views

Hi All

I have a requirement to export data into excel with header
in the first column and value in the next . 
How to achieve this in appian?

1 reply

csteward
May 18, 2021

You should be able to achieve this with a combination of a SQL view, and the Export Data Store Entity to Excel service.

You would create a view with SQL similar to below, pulling fields into one column and values into another.  Create a CDT and Data Store pointed to the view with fields "id" (or whatever your identifier is), "field" and "value".

The identifier value can be filtered on within the service, as well as utilizing false() for the Include Header parameter, which should give you the desired results.

SELECT id,'Request Id' as 'field',cast(t.requestById as varchar(100)) as 'value' FROM tblCOE_SAMPLE_TABLE t
UNION ALL
SELECT id,'Requester Name' as 'field',cast(t.requestByName as varchar(100)) as 'value' FROM tblCOE_SAMPLE_TABLE t
UNION ALL
SELECT id,'Request Date' as 'field',cast(t.requestSubmittedOn as varchar(100)) as 'value' FROM tblCOE_SAMPLE_TABLE t