Export reports to csv

(Vani Ganapa) #1

Squiz Matrix v5.4.5.1

I created a Structured Asset Report asset and the documentation talks about the ability to export generated report into CSV file. However I couldn’t find the ‘Download File’ button in ‘Reports’ screen.

(John gill) #2

Looks like bad docs, grepping the code ( it seems that only report_links and report_contexts have any kind of export. No other report contains the words ‘export’ or ‘download’ or ‘csv’.

(David Schoen) #3

For what it’s worth the top of the linked page does say:

Not all functionality listed here is available to all reports, but where it is available it works the same no matter what type of report you are using.

but it’s easy to miss and not obvious which bits are missing.

@vani.ganapa John is correct that the Structured Asset Report doesn’t have the options to export the report as either XML or CSV.

(Vani Ganapa) #4

Sure. Yeah I find it difficult to understand what doesn’t apply to which component. Thanks for confirming.

(Jennifer Weiley) #5

I have been doing some site audits using structured reports but there are a couple of critical gaps for me:

  1. Doesn’t include file size - this would be super helpful for cleaning up oversized images
  2. Can’t export to CSV - critical for analysing data.

I have resorted to scraping the information I can get from the report preview. Hardly an elegant solution and incredibly time consuming.

Is there something else in the Matrix reporting that would give me a list of assets in csv that included the fields required for a site audit or should I be using Funnelback? I’m reluctant to use a third party tool for something even SharePoint can do!


Generally you use Asset Listing or Search pages to create custom views of your site assets for reporting/auditing where default reports don’t suffice. This can be done really quickly once you are used to it (took me 3-4 minutes to create one for image size, can provide explanation if you need)

You can also apply a CSV design:

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

and change the formats to output comma separated values.
Same goes for outputting JSON, just use a -1 Position format to leave off the trailing comma, and sanitise data appropriately.

Anything that is exposed via keyword replacement can be printed as you see fit.

(Jennifer Weiley) #7

Thanks @bkelly. I’m using Squiz Matrix v5.4.0.1. Should I be able to create the report with the version I’m using?


Yes. https://matrix.squiz.net/manuals/asset-listing

For the example, you would want to list Image type assets, with the root node set to the Site asset.
On the Asset Sorting screen, add a new Asset Attribute Value for image size (call it ‘size’), then set the Default sorting below to ‘size’ descending.
Add %asset_file_size_in_bytes% or %asset_file_size_readable% to the type format bodycopy. For example (CSV):


(Jennifer Weiley) #9

@bkelly - thanks a million. I still haven’t managed to export to csv but I am a long way ahead from where I started.

I have been able to generate a list on a page and have the data I need for the audit. I’ll keep reading the manual until I figure out where I’m going wrong. You get the gold star for being super helpful.