Firestore/Firebase with Google Apps Script WebApp

1,169 views
Skip to first unread message

Chris Webb

unread,
Jan 12, 2020, 9:05:13 PM1/12/20
to Google Apps Script Community
I'm trying to create a webapp which writes the contents of a custom HTML form to a Firebase or Firestore container. I've used Romain's Firebase library, but I'm not really sure where to start with this. Does anyone have a tutorial, or a guide of getting going with this? I have the HTML form, what I think is the correct code, but nothing arrives in the container. 

function processForm(formObject) {
 
 var firestore = FirestoreApp.getFirestore('email', 'privatekey', 'projname');
 var firstName = formObject.firstname;
 logger.log(firstName);
 var lastName = formObject.lastname;
 var startDate = formObject.startdate;
 var endDate = formObject.enddate;
 var location = formObject.location;
 var sports = formObject.sports;
 var message = formObject.message;
  
  const data = {
    "lastName": lastName,
    "firstName":firstName,
    "startDate":startDate
  }

 firestore.createDocument("absence", data)
}

Any help would be appreciated

Hoang Trinh

unread,
Jan 13, 2020, 2:24:53 AM1/13/20
to Google Apps Script Community
Not sure if Romain's Firebase library can work with Firestore. I think it only works with Firebase Realtime Database.

I'm using Firestore also, and I have to use this library instead: https://github.com/grahamearley/FirestoreGoogleAppsScript
Reply all
Reply to author
Forward
0 new messages