A clojure google sheets integration example, based on java quickstart start with way more examples. This sample use a ibovespa prices this spreadsheet where the first tab is the stocks prices to read second one is a simulation for stocks that we bought.
Video how to integrate using this repo
- Access your google console developers and turn on the Google Sheets API and get credentials.json, find for "Authorized redirect URIs" and add
http://localhost:8888
- Add your credentials.json on resources path (you can find template.credentials.json as an example there)
- good to go, just run
lein run
- A browser will open requesting your auth, accept it
- You'll see the output of some ibovespa prices this spreadsheet, and also simple response of write it means that it worked, eg:
Stock, Current Price
EMBR3, 6.49
HGTX3, 17.19
CIEL3, 3.93
UNIP6, 27.4
IRBR3, 8.09
HBOR3, 10.68
MEAL3, 3.34
CYRE3, 23.44
ABEV3, 12.53
ABCB4, 11.89
AZUL4, 24.27
GOLL4, 17.39
JBSS3, 20.08
SHUL4, 12.51
JSLG3, 30.4
SCAR3, 35.79
TRIS3, 11.16
KEPL3, 39.51
POMO3, 2.56
TGMA3, 21.05
FESA4, 17.82
ALSO3, 24.33
CGRA4, 27.22
LEVE3, 17.77
ENEV3, 47.1
Now that we can read at least a sample spreadsheet lets do more, but to do it, we'll start to use our documentation see you there.
For more examples, look at my YouTube channel
lein test
sheet id
sheet id is a range on a sheet. All indexes are zero-based. it means that a first sheet is 0.
The easiest way to find the sheet id is in the browser URL when you open the spreadsheet / sheet: https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit#gid={sheetId}
more info regarding sheet cordinates see here
revoke google permission
You can revoke your app access here find for Third-party access
Copyright © 2020 FIXME
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.