sync-firebase-with-google-sheets icon indicating copy to clipboard operation
sync-firebase-with-google-sheets copied to clipboard

Firebase to sheets does not update a blank cell.

Open mrbjjackson opened this issue 4 years ago • 2 comments

Hi Alexander,

Firstly, thanks for making this. It's super helpful!

I'm using it to sync up a Google Sheet with a Firebase database.

I'm having an issue though.

My Google Sheet has a column called "Used".

When each row is added, this column is initially empty but I want to updated it to a timestamp when I run some code (when I use the data). i.e.

  firebase.database().ref('/sheets/Sheet1/' + entryID).update({
    Used: Date.now()
  }).then(
    console.log('Used updated')
  )

This code updates the Firebase record but it doesn't update the Google Sheet. This only happens when the cell is blank. If the cell contains anything at all, it is correctly updated.

I wondered if this was easily fixable? If you don't have time, if you could maybe give me some pointers towards fixing it myself. Any help you can give would be great. I've had a look at your code and unfortunately as I'm not a very advanced coder I'm struggling to follow it.

Thanks very much, Ben

P.S. A separate issue but something you might want to add to your documentation is that in Google Sheets, you have to select the option Run > Enable New App Script Runtime Powered By Chrome V8 in order for your code to work. I can add as a PR if you prefer?

mrbjjackson avatar Apr 10 '20 12:04 mrbjjackson

Sorry for not replying sooner, I will find time this evening to look into your issue.

alexandermckay avatar Apr 21 '20 00:04 alexandermckay

No worries. Thanks for replying. Just FYI I'm currently using the workaround of setting FALSE as a value in all empty cells in the Sheet I need to update via Firebase and this works fine. So no rush on the fix for my sake. :)

mrbjjackson avatar Apr 21 '20 08:04 mrbjjackson