CSV Data source export


(Chrishan) #1

Is it possible to create a downloadable CSV file link using an existing data source in Matrix?


#2

Use asset listing to output the data source contents as CSV, and apply CSV design:

<MySource_PRINT id_name="__global__" var="content_type" content_type="text/csv" />
<MySource_AREA id_name="page_body" design_area="body" />

(Chrishan) #3

Hi,

Thanks for the solution. I just need to create an anchor tag (as below) in a web page without keeping a separate CSV file, just need to get the data from CSV Data Source

image

image

Is your solution related to the paint layout? or can I use it within the Raw Html editor?


#4

Create a Design asset named ‘CSV’ with parse file as above. This sets the mime type. Apply it to an asset listing page that is formatted to output the data source records as comma seperated values.
Then hyperlink to the asset listing.


(Chrishan) #5

Thanks for the reply.

I applied the design file as you suggested.

image

But after I create a link and try to download, it will download only HTML code based on the master paint layout applied to it.

Will paint layout override the design file that I have applied?


#6

Sorry, you should also apply a ‘Blank’ paint layout. If you don’t have one already, simply create a new paint layout, make live and apply.


(Chrishan) #7

The Design below perfectly works for me

<MySource_PRINT id_name="__global__" var="content_type" content_type="application/csv" />
<MySource_PRINT id_name="__global__" var="content_attachment" extension="csv" />
<mysource_area id_name="body" design_area="body" />