Help:Spreadsheet format

From Linux Web Expert

Revision as of 13:08, 13 August 2021 by >MarkAHershberger ("previous" reads easier than "precursing")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Spreadsheet format
Outputs the result in spreadsheet file formats (xlsx, xls, ods and csv).
Further Information
Provided by: Semantic Result Formats
Added: 3.1.0
Removed: still supported
Requirements: "PHPSpreadsheed" library (handled by Composer)
Format name: spreadsheet
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
Authors: Stephan Gambke
Categories: export
Table of Contents

The result format spreadsheet is used to format query results as a spreadsheet. It is similar to the csv format except that value types are now explicitly handled. Previously one could export to csv and then import to e.g. MS Excel or LibreOffice Calc, however values could be wrongly interpreted as numbers when they were in fact strings. This format fixes that issue. It was introduced with version 3.1.0 of extension "Semantic Result Formats"No description was provided. and replaces the recursing result format "Excel"Outputs the result in Microsoft Office Excel file format (xls).1.

Note that the previous result format identifier "excel" is now an alias to "spreadsheet".

This format will automatically be available if the required PhpSpreadsheet library is installed.

Parameters

⧼validator-describe-header-parameter⧽ ⧼validator-describe-header-type⧽ ⧼validator-describe-header-default⧽ ⧼validator-describe-header-description⧽
templatefile ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The name of a spreadsheet file from the File namespace used for formatting the generated file
filename ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The filename for the download of the generated spreadsheet file
fileformat ⧼validator-type-string⧽ xlsx The format to be produced for the spreadsheet file. Allowed values: xlsx, xls, ods, csv. Default: xlsx

Examples

Example 1

Query without using result format specific parameters.

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |format=spreadsheet
}}
Result

Spreadsheet

Example 2

Query using result format specific parameters.

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size in km²
 |format=spreadsheet
 |fileformat=csv
 |filename=MyFilename
 |searchlabel=Export (csv)
}}
Result

Export (csv)

Installation

This section describes how to install the required PHPSpreadsheet library with Composer. To do this add the following as the last line of the "require" section in your "composer.local.json" file2 not forgetting to add a comma to the end of the preceding line:

"phpoffice/phpspreadsheet": "~1"

Now run the following command from the root directory of your wiki to complete the installation:

composer update --no-dev

#scite could not render a citation text for reference "gh:srf:445" because type "pullrequest" was not assigned to a template.

References

  1. ^ gh:srf:382 
  2. ^  See here for an example file: "composer.local.json"