0

Just a quick one. Someone I know is using google sheets as a Read database. Their data needs are very small so that's what they want to use. I have built an App in Adobe Air and this person wants to be able to display the sheet data inside this app. I know I am going to be using some form of Javascript to do this but I am not sure how to pull the cell data into the dynamic text fields. Any advice would be most welcomed.

James
  • 1
  • 2

1 Answers1

1

Way №1. The simplest way is to get the cell data as a CSV or TSV file (whatever is more suitable for your purposes) via special download link: https://docs.google.com/spreadsheets/d/{KEY}/export?gid={GID}&format=csv

Obviously, you are to replace {KEY} and {GID} with valid document key and sheet identifier respectively. The format parameter takes csv or tsv value.

You read it with old good URLLoader and get a plain text which you split into lines and then every line into values. There shouldn't be any problems.

IMPORTANT: The document should be shared as "anyone with link", so there are apparent security concerns, yet if security is not an issue, go for it as it is, as I said above, the simplest way.

Way №2. If security IS a concern, then you need to use the gspread library. It does not have an AS3 port, but it has JS one so I assume it is the one that acquaintance of yours uses: https://developers.google.com/sheets/api/quickstart/js

You don't run your app in the browser, JS wouldn't really be your ally here, you will need a server with PHP proxy (that will handle auth and communication with Google Sheets) or a local Python app maybe (it is not difficult to build and run a simple HTTP serving application), it is up to you to decide which one of the available gspread ports will be simpler for you to use and serves your needs best.

Organis
  • 7,243
  • 2
  • 12
  • 14