Write multiple topics into one csv - one column per topic

Hello,
I have several sensors subscribed via mqtt. I write the payload with date, time and value in a csv.

{"timestamp":1672341312998,"temperature":33.25,"topic":"Sensor 1"}

{"timestamp":1672341342848,"temperature":20.88,"topic":"Sensor7"}

The topic is now written in the same column each time, which is not so nice for the evaluation. If I want to compare two curves in a graph I have to post-process the csv.

Is there a possibility to save the different topics in separate columns of the csv?

[{"id":"7b0b2a06d7588415","type":"csv","z":"b1b4404e9db3abf5","name":"","sep":",","hdrin":"","hdrout":"all","multi":"one","ret":"\\n","temp":"timestamp,temperature,topic","skip":"0","strings":true,"include_empty_strings":false,"include_null_values":false,"x":1290,"y":620,"wires":[["5169f647f3384738"]]}]

Would be thankful for any help.

Could be done, would I, probably not.

Either way would require processing.

Here are a couple of examples.

[{"id":"911b748243bcbec1","type":"inject","z":"da8a6ef0b3c9a5c8","name":"seperate columns","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"timestamp\":1672341312998,\"temperature\":33.25,\"topic\":\"Sensor 1\"} , {\"timestamp\":1672341342848,\"temperature\":20.88,\"topic\":\"Sensor7\"}]","payloadType":"json","x":130,"y":1480,"wires":[["a583426dc0afdb01"]]},{"id":"a583426dc0afdb01","type":"split","z":"da8a6ef0b3c9a5c8","name":"simulate incoming payloads","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":380,"y":1480,"wires":[["c09fcdfe83a848d1"]]},{"id":"c09fcdfe83a848d1","type":"change","z":"da8a6ef0b3c9a5c8","name":"","rules":[{"t":"set","p":"payload[msg.payload.topic]","pt":"msg","to":"payload.topic","tot":"msg"},{"t":"delete","p":"payload.topic","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":1540,"wires":[["f480cb42a553042e"]]},{"id":"f480cb42a553042e","type":"csv","z":"da8a6ef0b3c9a5c8","name":"","sep":",","hdrin":"","hdrout":"once","multi":"one","ret":"\\n","temp":"timestamp,temperature,Sensor 1,Sensor7","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":330,"y":1540,"wires":[["124e439c09f3b9d6"]]},{"id":"124e439c09f3b9d6","type":"join","z":"da8a6ef0b3c9a5c8","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":490,"y":1540,"wires":[["98b1790b68156fdb"]]},{"id":"98b1790b68156fdb","type":"debug","z":"da8a6ef0b3c9a5c8","name":"debug 119","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":1540,"wires":[]},{"id":"ac378acc7ed24a10","type":"inject","z":"da8a6ef0b3c9a5c8","name":"convert normal csv to chart","props":[{"p":"plot","v":"[\"Sensor 1\",\"Sensor7\"]","vt":"json"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":180,"y":1640,"wires":[["4c1455110f0d4a9b"]]},{"id":"4c1455110f0d4a9b","type":"template","z":"da8a6ef0b3c9a5c8","name":"simulate csv read","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"timestamp,temperature,topic\n1672341312998,33.25,Sensor 1\n1672341342848,20.88,Sensor7\n","output":"str","x":250,"y":1680,"wires":[["9d1007c55e7276bb"]]},{"id":"9d1007c55e7276bb","type":"csv","z":"da8a6ef0b3c9a5c8","name":"","sep":",","hdrin":false,"hdrout":"all","multi":"mult","ret":"\\n","temp":"x,y,topic","skip":"1","strings":true,"include_empty_strings":"","include_null_values":"","x":430,"y":1680,"wires":[["ab07e7a73cf53a8a"]]},{"id":"ab07e7a73cf53a8a","type":"change","z":"da8a6ef0b3c9a5c8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\t    {\t        \"series\": $$.plot[],\t        \"data\": $$.plot[]@$i.[\t            [\t                $$.payload[$.topic = $i] ~> |$|{},[\"topic\"]|\t            ]\t        ],\t        \"labels\": $$.plot[]\t    }\t]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":1680,"wires":[["4defde27cebe40b0"]]},{"id":"4defde27cebe40b0","type":"debug","z":"da8a6ef0b3c9a5c8","name":"debug 120","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":1620,"wires":[]}]