brandonmp / gatsby-source-google-sheets

A GatsbyJS plugin that pulls nodes from rows in a Google Sheet.
90 stars 32 forks source link

Cells containing only emoji characters are mapped to 0 number #2

Closed pieh closed 6 years ago

pieh commented 6 years ago

Regex here https://github.com/brandonmp/gatsby-source-google-sheets/blob/master/src/fetch-sheet.js#L57 will remove emoji from value and if cell contains only emoji this will leave empty string which will be treated as number (!isNaN('') === true) and value will be converted to 0.

This breaks type infering for that column in gatsby - https://github.com/gatsbyjs/gatsby/issues/3913

Sheet that can be used to reproduce - https://docs.google.com/spreadsheets/d/19Q6wT_RKouS9PQTBxsAiek8fv-fSpCzO2zXB1tL_W-Y/edit#gid=0 (cell E57).

I'm not familiar with google sheets api. Is there a way to get numeric value without applied formatting? It seems that it's not possible when using getRows function.

brandonmp commented 6 years ago

thanks @pieh , this should be fixed.

i added the "🔑🔑🔑🔑🔑🔑🔑🔑🔑🔑🔑🔑🔑" to a unit test to make sure this stays fixed