Help:Excel format

From semantic-mediawiki.org
Jump to: navigation, search
Excel format
Outputs the result in Microsoft Office Excel file format (xls).
Further Information
Provided by: Semantic Result Formats
Added: 1.9.0
Removed: still supported
Requirements: MW 1.21+
"PHPExcel" extension (includes "PHPExcel" library)
or

MW 1.22+
"PHPExcel" library (handled by Composer)

Format name: excel
Enabled by default: 
Indicates whether the result format is enabled by default upon installation of the respective extension.
yes
Authors: Kim Eik
Categories: export
Group:
Table of Contents

↓ INFO ↓

The result format excel 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 excel, however values could be wrongly interpreted as numbers when they were in fact strings. This format fixes that issue.

If the PHPExcel library (required) is installed this format will automatically be available (SRF ≥ 1.9.1).

Parameters

There are no parameters specific to the excel format.

Example

NoteNote:  This result format is not available on this wiki. Thus an example output cannot be provided.

{{#ask:
 [[Category:City]]
 [[located in::Germany]] 
 | ?population
 | ?area#km² = Size in km²
 | searchlabel=Download result as xls-file for MS Excel
 | format=excel
}}

Installation

This describes how to install the required PHPExcel library with Composer, which is recommended method for MW 1.22+. See the page on the PHPExcel extension for installation instructions for MW 1.21+ without using Composer.

Either enter the following in you command line:

composer require phpoffice/phpexcel 1.8.1

or add the following as the last line of the "require" section in your "composer.json" file:

"phpoffice/phpexcel": "1.8.1"

NoteNote:  Replace the version number "1.8.1" of this example with the version number you want to install at your convenience.

Enabling

This result format is not enabled by default on a wiki if you are using SMW 1.8. To enable it the following line must be added to the file LocalSettings.php below the inclusion of the Semantic Result Formats extension:
$srfgFormats[] = 'excel';
Make sure that the required PHPExcel library is installed and found (see the /vendor/ directory).

For SMW 1.9 and higher this format is enabled automatically as soon as the required PHPExcel library was installed and found (see the /vendor/ directory).

See also

https://gerrit.wikimedia.org/r/#/c/43421/



This documentation page applies to all SMW versions from 1.9.0 to the most current version.
     

Help:Excel format en 1.9.0