Function __global->make_spreadsheet

Definitions

sources/files_spreadsheets_write.php

  • Output data to a spreadsheet file.Generally it is better to write row-by-row rather than use this function, for performance reasons.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: object

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
&$path ?PATH Yes No required parameter N/A N/A File to write into (null: create a temporary file and return by reference)
$data array No No required parameter N/A N/A List of maps, each map representing a row
$filename ?ID_TEXT No No Null N/A N/A Filename we will be using (null: try and derive from $outfile_path, otherwise generate a .csv filename)
$metadata array No No [] N/A N/A List of maps, each map representing metadata of a row; supports 'url'; will only be used by file formats that support it

Returns

  • A CMS_Spreadsheet_Writer object (pre-closed, you don't need to close it)
  • Type: object
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Output data to a spreadsheet file.Generally it is better to write row-by-row rather than use this function, for performance reasons.
 *
 * @param  ?PATH $path File to write into (null: create a temporary file and return by reference)
 * @param  array $data List of maps, each map representing a row
 * @param  ?ID_TEXT $filename Filename we will be using (null: try and derive from $outfile_path, otherwise generate a .csv filename)
 * @param  array $metadata List of maps, each map representing metadata of a row; supports 'url'; will only be used by file formats that support it
 * @return object A CMS_Spreadsheet_Writer object (pre-closed, you don't need to close it)
 */

function make_spreadsheet(?string &$path, array $data, ?string $filename = null, array $metadata = []) : object