0
まず、Firebaseにデータを送信するアプリを作った。データがfirebaseに保存されたら、FirebaseからGoogle Sheetに保存されます。 Firebaseからデータを取得し、Googleアプリケーションスクリプトを使用してGoogleシートに保存します。Google App Scriptを使用してFirebaseからデータを取得してGoogleシートに保存する方法は?
まず、Firebaseにデータを送信するアプリを作った。データがfirebaseに保存されたら、FirebaseからGoogle Sheetに保存されます。 Firebaseからデータを取得し、Googleアプリケーションスクリプトを使用してGoogleシートに保存します。Google App Scriptを使用してFirebaseからデータを取得してGoogleシートに保存する方法は?
Here's a tutorial.「異なるクエリでFirebaseからデータを読み込む」セクションにスクロールします。ここで
はそれの一部だ:
あなたはFirebaseに保存されているすべてのデータを取得したい場合は、単にパスなし/場所で のgetData()を実行します。
function getAllData() { var firebaseUrl = "https://script-examples.firebaseio.com/"; var base = FirebaseApp.getDatabaseByUrl(firebaseUrl); var data = base.getData(); for(var i in data) { Logger.log(data[i].firstName + ' ' + data[i].lastName); } }
特定のレコードを取得するには、正しいパス/キーを指定します。
function getContact() { var firebaseUrl = "https://script-examples.firebaseio.com/"; var base = FirebaseApp.getDatabaseByUrl(firebaseUrl); var contact = base.getData("Alex-MARTIN"); Logger.log(contact); }
か、直接値の特定(特定 接触用など。国)を取得
function getContactCountry() { var firebaseUrl = "https://script-examples.firebaseio.com/"; var base = FirebaseApp.getDatabaseByUrl(firebaseUrl); var country = base.getData("Alex-MARTIN/country"); Logger.log(country); }