Exporting data of structure field to csv or Excel

Hi,
is there any plugin or other tool to export the contents of a structure field to CSV oder XLS?

Not that iā€™m aware of, but if you google around, PHP has a built in thing to generate CSV. You can do it from an array. Will work in a template, or via a route or something.

<?php

$list = array (
    array('header 1', 'header 2', 'header 3', 'header 4'),
    array('5656', '454545', '5455', '5454'),
    array('541212', '454545', '5455', '5454'),
    array('541212', '454545', '5455', '5454'),
);

$fp = fopen('file.csv', 'wb');

foreach ($list as $fields) {
    fputcsv($fp, $fields);
}

fclose($fp);

You would have to convert the structure object first, though, i.e. get the field names for the header values, and then the actual values for the rest.

Can someone give me more details about that?
I have structure field for form submissions and I need export this data to csv or excel.

Thanks