Widget:Google Spreadsheet

De Wiki des possibles
Révision datée du 15 novembre 2022 à 12:42 par <bdi>Stéphane</bdi> (discussion | contributions) (Correction : Ajout du Widget)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à :navigation, rechercher

This widget allows you to add Google Sheets to your wiki page.

Add Template:Spreadsheet directly under the widget to allow readers access to the spreadsheet. The template documentation contains an example.

Usage

There are four supported URL formats.

First URL format

The URL looks like this:

https://docs.google.com/spreadsheets/d/1pxLq_tSUlY2xEAYlK7R2pu70nT27Jn363WtlCqtAdIc/edit#gid=661167613

Parameters:

  • key - key parameter in document URL
  • width and height define spreadsheet dimensions, 500x300 is default, but you might want to copy it from embed code since size depends on fields you have

To insert this widget, use the following code:

{{#widget:Google Spreadsheet
|key=1pxLq_tSUlY2xEAYlK7R2pu70nT27Jn363WtlCqtAdIc
|width=500
|height=300
}}

Results in:

Second URL format

The second format has a URL which looks like this:

https://docs.google.com/spreadsheets/d/e/2PACX-1vRhM_MeJnMphY5A1zuOvAr7IL2Jj41Qg51Scd6MoNj0TIjC2LHVqjUwudbIwa-26Ulgh1kzzTTLBfif/pubchart?oid=226162492&?widget=true&headers=false

Parameters:

  • key - key parameter in document URL
  • oid - object ID in document URL
  • width and height define spreadsheet dimensions, 500x300 is default, but you might want to copy it from embed code since size depends on fields you have
{{#widget:Google Spreadsheet
|key=2PACX-1vRhM_MeJnMphY5A1zuOvAr7IL2Jj41Qg51Scd6MoNj0TIjC2LHVqjUwudbIwa-26Ulgh1kzzTTLBfif
|oid=226162492
|width=500
|height=300
}}

Results in:

Third URL format

The third format has a URL which looks like this:

https://docs.google.com/spreadsheets/d/e/2PACX-1vQmKS6wsrz6q34e2A7PF_4Pu7MDkChqmIQ8f8PAe-jAmQcmYx1ub-ruE--cmAql0zfI6H1PmqQbcNCb/pubhtml

Parameters:

  • key - key parameter in document URL
  • pubhtml - must be present and blank
  • width and height define spreadsheet dimensions, 500x300 is default, but you might want to copy it from embed code since size depends on fields you have
{{#widget:Google Spreadsheet
|key=2PACX-1vQmKS6wsrz6q34e2A7PF_4Pu7MDkChqmIQ8f8PAe-jAmQcmYx1ub-ruE--cmAql0zfI6H1PmqQbcNCb
|pubhtml=
|width=500
|height=300
}}

Results in:

Fourth URL format

The fourth format has a URL which looks like this:

https://docs.google.com/spreadsheets/d/e/2PACX-1vQmKS6wsrz6q34e2A7PF_4Pu7MDkChqmIQ8f8PAe-jAmQcmYx1ub-ruE--cmAql0zfI6H1PmqQbcNCb/pubchart?oid=798669522&format=interactive

Parameters:

  • key - key parameter in document URL
  • oid - object ID in document URL
  • pubchart - must be present and blank
  • width and height define spreadsheet dimensions, 500x300 is default, but you might want to copy it from embed code since size depends on fields you have
{{#widget:Google Spreadsheet
|key=2PACX-1vQmKS6wsrz6q34e2A7PF_4Pu7MDkChqmIQ8f8PAe-jAmQcmYx1ub-ruE--cmAql0zfI6H1PmqQbcNCb
|oid=798669522
|pubchart=
|width=500
|height=300
}}

Results in:

Security NOTE

Keep in mind that to use this widget you must make the document you're publishing to be open for everybody to see which might be undesirable for some uses (intranets, closed groups and etc.)

Widget internals

Documentation for this widget can be found at MediaWiki Widgets.

The first URL format is based on the Google Sheets "Embed" code shown in Google Docs — Support — WordPress.com.

Subsequent formats are based on actual URLs.

Widgets do not use parser functions. Instead, a template programming language known as "Smarty" is used. Refer to the Smarty 3 Manual for the details.


Modèle:Helpful tools