Closed rufuspollock closed 3 years ago
In GitLab by @rufuspollock on Apr 29, 2020, 21:57
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:12
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:13
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:13
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:14
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:15
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:17
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:32
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:33
changed the description
In GitLab by @monikappv on Apr 30, 2020, 01:33
@rufuspollock have some small progress on this - you can have a look... will continue tomorrow
In GitLab by @monikappv on Apr 30, 2020, 21:02
changed the description
In GitLab by @monikappv on Apr 30, 2020, 21:09
changed the description
In GitLab by @monikappv on Apr 30, 2020, 21:10
@rufuspollock found a better approach :sparkles: updated the issue description.
can you give me a link to the endorsers spreadsheet so that I can apply it to our case?
In GitLab by @rufuspollock on Apr 30, 2020, 21:56
For now can you make up a spreadsheet:
| Name | Organization | Comment |
Also can we make layout look quite nice e.g. https://www.sustainablewebmanifesto.com/signatures/
BTW there are two options here: list gets updated a) each time we build and b) each time someone visits the page ... At least for numbers i guess we want for b) and probably same for signatories ... but i could like with (a).
PS (separate issue): can you add a share this like at bottom of https://www.sustainablewebmanifesto.com/
In GitLab by @monikappv on May 1, 2020, 10:24
@rufuspollock ok I will
P.S. locally it gets updated on page refresh, but I have to investigate a bit for the production mode
In GitLab by @rufuspollock on May 3, 2020, 18:30
changed title from Automate display of {-Endorsers-} to Automate display of {+Directory of Initiatives ...+}
In GitLab by @rufuspollock on May 3, 2020, 18:35
changed title from {-Automate display of Directory of Initiatives ...-} to {+Find a way to display data from a google spreadsheet in vuepress+}
In GitLab by @rufuspollock on May 3, 2020, 18:35
changed the description
In GitLab by @rufuspollock on May 3, 2020, 18:35
moved to datopian/tech/breakable-toys#8
In GitLab by @rufuspollock on Apr 29, 2020, 21:45
Pull data from a google spreadsheet.
When showing the total of endorsers (and some of their names) I want to pull data from spreadsheet (as that is where that info is stored) so that we have that info available in vuepress to display in a component
When displaying the directory of initiatives I want to pull data from a spreadsheet so that non-technical people can manage info in a spreadsheet and we can show it nicely on the website
Acceptance
Tasks
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}?key={API key}
wherespreadsheetId
= ID of the spreadsheet,range
= relevant cells range e.g. A1%3AC (A1:C) andAPI key
= API key (can be generated here https://developers.google.com/sheets/api/quickstart/js)Research
Solution
AXIOS
have a spreadsheet --> get shareable link --> "transform" into API --> use axios to pull data from the API (see code below)
How to
Using
Google Sheets API
:star: (printing in this case column2)Using
sheet.best
(tool for generating API out of google sheet) (printing in this case column2)helpful article: https://developer.school/how-to-use-vue-js-json-server-and-axios/
How to "transform" a spreadsheet into API
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}?key={API key}
wherespreadsheetId
= ID of the spreadsheet,range
= relevant cells range e.g. A1%3AC (A1:C) andAPI key
= API key (can be generated here https://developers.google.com/sheets/api/quickstart/js)Example
Example table:
Outcome: (using the code above - in this case get only values in column2)
Values on the site get updated on refresh when updating the spreadsheet :heavy_check_mark: