# How to pass a data type to google sheet?

**URL:** <https://discourse.nodered.org/t/how-to-pass-a-data-type-to-google-sheet/25158>\
**Category:** General\
**Created:** [19 April 2020 21:20 UTC](https://discourse.nodered.org/t/how-to-pass-a-data-type-to-google-sheet/25158 "2020-04-19T21:20:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![calcioscacchi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/calcioscacchi/32/16898_2.png) [@calcioscacchi](https://discourse.nodered.org/u/calcioscacchi)\
**Post date:** [19 April 2020 21:20 UTC](https://discourse.nodered.org/t/how-to-pass-a-data-type-to-google-sheet/25158/1 "2020-04-19T21:20:52Z")

</div>

Hi there,

i'm trying to pass a date to google sheet, and from there (using excel formulas MONTH and NUMWEEK) i want to extract the week and the month, due to create a weekly mean of the values.

But, unfortunately seems that in Json the date format doesn't exists. I tried with moment node, but I just modify the date format (from mm-dd-yyyy to dd/mm/yyyy), and it still return a string.

Suggestion?

Otherwise, I could find the way to extract the week from the date in node red and pass this info to google sheet.

---

<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:** [19 April 2020 21:33 UTC](https://discourse.nodered.org/t/how-to-pass-a-data-type-to-google-sheet/25158/2 "2020-04-19T21:33:06Z")

</div>

Try to stick to ISO format date...  
YYYY-MM-DD HH:MM:SS  
... This avoids any confusion regarding which is month and which part is day.

---

<div class="post-metadata">

**Author:** ![calcioscacchi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/calcioscacchi/32/16898_2.png) [@calcioscacchi](https://discourse.nodered.org/u/calcioscacchi)\
**Post date:** [19 April 2020 21:54 UTC](https://discourse.nodered.org/t/how-to-pass-a-data-type-to-google-sheet/25158/3 "2020-04-19T21:54:08Z")

</div>

That's not the problem, i'm afraid moment node will return always a string.

But i solve with the other idea: get the number of the week frm the date. I set the moment node to return date in WW format, then i change the string into a number looking at this discussion 🙂

> [@String to number](https://discourse.nodered.org/t/string-to-number/988/2):
>
> The Node-RED Function node uses JavaScript. A quick google search for how to do that will reveal lots of answers, for example: Nick

---

<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:** [18 June 2020 21:54 UTC](https://discourse.nodered.org/t/how-to-pass-a-data-type-to-google-sheet/25158/4 "2020-06-18T21:54:25Z")

</div>

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