Run Once from Function Node to Google Sheet Node -Array To String

Try to figure out how to convert the array to String to make sure all the Key match in the Google Sheet

Hey @Victor_Tong,

Are you trying to put all that data into the consignment entries field or add them as new field items?

I think it just flat it to string to save it into Google Sheet.
Since Google Sheet do not handle , array in a single cell

Everything else is working perfectly.

The key match the json, just the array in consignment need to be flat into pure string, rather than object object

Can you share the json output of the node before the google sheet node?

1 Like

Thanks mate

[

{

"consignmentCode":177243790,

"consignmentStatus":"ORDER_COMPLETE",

"orderId":"H2209040XXXXXXXXXX",

"orderDate":"2022-09-04 02:15:42",

"trackingId":5720437904,

"transactionId":"15481123719086096-3659485219_20220904021541",

"pickUpDate":"2098-01-01 11:00:00",

"deliveryDate":"2098-01-01 14:00:00",

"deliveryMethod":"merchant-delivery",

"consignmentEntries":[

{

"skuId":"H9202001_S_SLAD0008",

"skuNameEn":"Extended Color Candle Smart Light Bulbs E14",

"skuNameZh":"Extended Color Candle Smart Light Bulbs E14 白光彩光蠟燭智能燈膽",

"brand":"ADUROSMART ERIA",

"quantity":3,

"totalPrice":990

}

],

"syncTime":""2022-10-22T00:48:12.688+08:00""

},

{

"consignmentCode":177254843,

"consignmentStatus":"ORDER_COMPLETE",

"orderId":"H22XXXXXXXXXXX",

"orderDate":"2022-09-04 10:11:45",

"trackingId":5720548439,

"transactionId":"15481123719086096-3641741684_20220904101144",

"pickUpDate":"2098-01-01 11:00:00",

"deliveryDate":"2098-01-01 14:00:00",

"deliveryMethod":"merchant-delivery",

"consignmentEntries":[

{

"skuId":"H9202001_S_Bruno_BAK801_WH",

"skuNameEn":"BRUNO Instant Hot Water Dispenser White 即送冰川纹玻璃杯❄",

"skuNameZh":"BRUNO 即熱飲水機 純白色 香港行貨 即送冰川纹玻璃杯❄",

"brand":"BRUNO",

"quantity":1,

"totalPrice":998

}

],

"syncTime":""2022-10-22T00:48:12.688+08:00""

}

]

Hey @Victor_Tong,

One thing you could do is use a set node to tweak the data you want to send and for the consignment entries you can use {{ JSON.stringify($json["consignmentEntries"]) }} the workflow example below seems to result in the data being saved to the sheet.

1 Like

Thanks Jon

May I ask what is the best practice for working rest of them field?

This take care of consigmentEntries?

{{ JSON.stringify($json["consignmentEntries"]) }}

I have to do a SET node for Google Sheet?

Hey @Victor_Tong,

You got it, It is probably best to use a set node for all the fields. This will change soon when the overhaul of the Google Sheets node comes out though so you will be able to set it in the node rather than needing the extra step.

Great news, everyone is depending on google sheet those days
Thanks Jon

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