Get and Show cell's value from Google Spreadsheet Widget for Dashing.
gem 'google-api-client'
gem 'google_drive'
dashing install e0ad37c2e137d2da0916
To use this widget, you'll first need to set up a Google API project and get client_secret.json
.
- Go to https://code.google.com/apis/console
- Click 'Create Project'
- Enable 'Drive API' service and accept both TOS's
- Click 'API Access' in the left-hand nav menu
- Click 'Create an OAuth 2.0 Client ID'
- Enter a product name (e.g. Dashing Widget) - logo and url are optional
- Click 'Next'
- Under Application Type, select 'Installed Application'
- Click 'Create Client ID'
- Click 'Download JSON'
- Open JSON file and note
client_id
andclient_secret
. - Set
client_id
andclient_secret
asENV['GOOGLE_DRIVE_CLIENT_ID']
andENV['GOOGLE_DRIVE_CLIENT_SECRET']
. - Install this widget and open dashboard with web-browser. Then, redirect to Google Drive OAuth Page. If you heck the permissions, approve the request. (
credential-oauth2.json
is created.) - Second time later without being asked for approval. Start use by setting
Configuration
below .
ENV['DASHING_TARGET_SPREAD_SHEET_ID']
- Specify the target Google Spreadsheet ID. If spreadsheet's url is
https://docs.google.com/spreadsheets/d/abcdefghijklmnopqrstuvwxyz/
, spreadsheet's id isabcdefghijklmnopqrstuvwxyz
.
- Specify the target Google Spreadsheet ID. If spreadsheet's url is
WORKSHEET_NUMBER
- Specify worksheet number of the target Google Spreadsheet. This number is zero start.
CELLS_ROW_NUMBER
- Specify row number of target worksheet.
CELLS_COLUMN_NUMBER
- Specify column number of target worksheet.
Finally, add this to your dashboard layout file.
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="google_spreadsheet" data-view="GoogleSpreadsheet" data-title="Google Spreadsheet Cells Value"></div>
</li>
Where exactly do the Configuraiton steps take place? In the .rb file? Can't get this to work.... thank you!