# Google sheet TypeError

**URL:** <https://discourse.nodered.org/t/google-sheet-typeerror/55615>\
**Category:** Dashboard\
**Created:** [23 December 2021 14:03 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615 "2021-12-23T14:03:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maruthi](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Maruthi](https://discourse.nodered.org/u/Maruthi)\
**Post date:** [23 December 2021 14:03 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615/1 "2021-12-23T14:03:57Z")

</div>

I'm using node red in Raspberry pi 3b+  
Trying to Connect my google sheet to node red, But not Getting any data from Sheet

Getting below error

(node:361) UnhandledPromiseRejectionWarning: TypeError: response.data.values.flat is not a function  
at /home/pi/.node-red/node\_modules/node-red-contrib-google-sheets/gsheet.js:53:60  
at createAPIRequestAsync.then.r (/home/pi/.node-red/node\_modules/googleapis-common/build/src/apirequest.js:49:53)  
at process.\_tickCallback (internal/process/next\_tick.js:68:7)  
(node:361) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

Flow:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb13063261027e9ccb9eb7613c21c496c62c6599.png)

Followed same with other raspberry pi and its working out there

Tried Reinstalling Google-sheet  
Rebooting PI

Nothing worked

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 December 2021 14:53 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615/2 "2021-12-23T14:53:19Z")

</div>

What versions of node-red and nodejs are you using on the one that works and the one that doesn't? The node-red version is shown at the bottom of the menu dropdown. For the nodejs version open a terminal and run  
`node -v`  
Also which version of the gsheet node (check in Manage Palette)?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 December 2021 15:26 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615/3 "2021-12-23T15:26:56Z")

</div>

> [@Maruthi](#):
>
> TypeError: response.data.values.flat is not a function

What version of node is your node-red server running in?

The `flat` function is not available in node \< v11

---

<div class="post-metadata">

**Author:** ![Maruthi](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Maruthi](https://discourse.nodered.org/u/Maruthi)\
**Post date:** [30 December 2021 08:42 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615/4 "2021-12-30T08:42:32Z")

</div>

On successful working pi  
Node-red: 1.0.3  
Nodejs: 10.15.2

Current pi  
Node-red: 1.3.4  
Nodejs: 10.24.0

Google sheet node : 1.1.0

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 December 2021 08:49 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615/5 "2021-12-30T08:49:20Z")

</div>

That is quite surprising. Something else must be going on - my suspicion is something you have installed on the working pi has patched the Array prototype (naughty naughty) to support `flat()`

Either way, nodejs 10.x is [End Of Life](https://endoflife.date/nodejs) and no longer receives security updates so you should update nodejs regardless.

I suspect it will work on both PI with nodejs v12 or greater.

* * *

For reference, you can update latest node-red and nodejs at the same time using the official script (info is in the node-red online docs)

---

<div class="post-metadata">

**Author:** ![Maruthi](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Maruthi](https://discourse.nodered.org/u/Maruthi)\
**Post date:** [30 December 2021 08:59 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615/6 "2021-12-30T08:59:06Z")

</div>

Okay, I'll update and check

---

<div class="post-metadata">

**Author:** ![Maruthi](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Maruthi](https://discourse.nodered.org/u/Maruthi)\
**Post date:** [30 December 2021 10:16 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615/7 "2021-12-30T10:16:26Z")

</div>

Thanks for suggestion  
It worked after node update  
I've updated Node to 14.18.2 and node red to 2.1.4

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 January 2022 10:17 UTC](https://discourse.nodered.org/t/google-sheet-typeerror/55615/8 "2022-01-13T10:17:10Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
