Widget:Google Spreadsheet: Unterschied zwischen den Versionen
(imported Widget) |
(kein Unterschied)
|
Aktuelle Version vom 3. Februar 2021, 14:15 Uhr
This widget allows you to add Google Sheets to your wiki page.
This widget code is taken from https://www.bogleheads.org/wiki/Widget:Google_Spreadsheet .
1 Usage
There are four supported URL formats.
1.1 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:
1.2 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:
1.3 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:
1.4 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:
2 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.)
3 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.