Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Trekels/php-sheet
Push json data to google sheets
https://github.com/Trekels/php-sheet
ci google-sheets json php
Last synced: 13 days ago
JSON representation
Push json data to google sheets
- Host: GitHub
- URL: https://github.com/Trekels/php-sheet
- Owner: Trekels
- License: mit
- Created: 2019-05-13T17:43:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T17:49:20.000Z (over 2 years ago)
- Last Synced: 2023-03-05T06:05:04.084Z (over 1 year ago)
- Topics: ci, google-sheets, json, php
- Language: PHP
- Size: 2.93 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHP-sheet
--------Very simplistic cli tool to push json data to a google sheet. The main
purpose is to push artifact data from CI build steps to google sheets in order
to analyze project quality over time.### Allow access to a sheet
1. Create project on [google cloud platform](https://console.developers.google.com/apis/dashboard).
2. Click Enable APIs and enable the Google Sheets API
3. Go to Credentials, then click Create credentials, and select Service account key
4. Choose New service account in the drop down. Give the account a name.
5. For Role I selected Project -> Project -> Editor
6. For Key type, choose JSON (the default) and download the file. This file contains a private key so be very careful with it
7. Finally, edit the sharing permissions for the spreadsheet and give read/write access to the client_email address you can find in the JSON file[credits to fillup.io](https://www.fillup.io/post/read-and-write-google-sheets-from-php/)
### Install
Download the phar
```bash
$ wget https://github.com/Trekels/php-sheet/releases/download/1.0.0/php-sheet.phar -O php-sheet
```Make it executable and move to your bin folder.
```bash
$ sudo chmod a+x php-sheet.phar
$ sudo mv php-sheet /usr/local/bin/php-sheet
```### Push the data.
```bash
bin/phpsheet data ./path/to/file.json -c path/to/creds.json -s sheet_id# if env vars are set :)
bin/sheet data ./path/to/file.json
````--credentials | -c` can be omitted if the credentials json string is set as env var `GOOGLE_SHEET_AUTH`.
`--sheet | -s` can be omitted if env var `GOOGLE_SHEET_ID` is set.