Change format numbers to percent and currenct

Hi everyone!

I’m creating a bot to show daily stats from Facebook and would like it to show percentage and currency instead of just numbers (I’ve attached a screenshot of how it looks vs how I want it to look)

Is there a way to make these changed?


What is the error message (if any)?

Please share your workflow:

{
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “2585abe1efb938917d28de49b9d3e9c5a474780662015cadd3f33854df4f952a”
},
“nodes”: [
{
“parameters”: {
“rule”: {
“interval”: [
{
“triggerAtHour”: 8
}
]
}
},
“id”: “744a3184-2970-4adb-adbc-61603a52099b”,
“name”: “Daily Client Stats Scheduler”,
“type”: “n8n-nodes-base.scheduleTrigger”,
“typeVersion”: 1,
“position”: [
120,
1100
]
},
{
“parameters”: {
“resource”: “boardItem”,
“operation”: “getByColumnValue”,
“boardId”: “4347525293”,
“columnId”: “status”,
“columnValue”: “Active”,
“returnAll”: true
},
“id”: “b1129b05-ee68-47e7-b4a5-8cf162504659”,
“name”: “Get monday item | Daily Client Stats”,
“type”: “n8n-nodes-base.mondayCom”,
“typeVersion”: 1,
“position”: [
360,
1100
],
“credentials”: {
“mondayComApi”: {
“id”: “2”,
“name”: “Monday.com account”
}
}
},
{
“parameters”: {
“batchSize”: 1,
“options”: {}
},
“id”: “b732ccc3-2d7b-4923-a645-3777ece52f36”,
“name”: “Split In Batches”,
“type”: “n8n-nodes-base.splitInBatches”,
“typeVersion”: 2,
“position”: [
620,
1100
]
},
{
“parameters”: {
“documentId”: {
“__rl”: true,
“value”: “1jf80OsnLIppDsiFq17jOZCaZkUuF2FG0KuWVJxvnoiI”,
“mode”: “list”,
“cachedResultName”: “Clients FBads Stats”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1jf80OsnLIppDsiFq17jOZCaZkUuF2FG0KuWVJxvnoiI/edit?usp=drivesdk
},
“sheetName”: {
“__rl”: true,
“value”: “={{ $json.column_values[16].text }}”,
“mode”: “id”
},
“options”: {}
},
“id”: “1781bb0c-ec11-4f0f-b998-120bf92344ed”,
“name”: “Google Sheets”,
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 3,
“position”: [
860,
1100
],
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “1”,
“name”: “Yorads Google API”
}
}
},
{
“parameters”: {
“operation”: “limit”
},
“id”: “f0d61e43-cc79-42b8-86ab-fce8234e9a59”,
“name”: “Item Lists1”,
“type”: “n8n-nodes-base.itemLists”,
“typeVersion”: 2,
“position”: [
1080,
1100
]
},
{
“parameters”: {
“resource”: “message”,
“guildId”: {
“__rl”: true,
“value”: “1095279318961238046”,
“mode”: “list”,
“cachedResultName”: “Byggvekst”,
“cachedResultUrl”: “Discord
},
“channelId”: {
“__rl”: true,
“value”: “1095279477946335284”,
“mode”: “list”,
“cachedResultName”: “:mega:-ads-stats”,
“cachedResultUrl”: “Discord
},
“content”: “=:yellow_circle:** {{ $(‘Get monday item | Daily Client Stats’).item.json.name }}**:yellow_circle:\n\nYESTERDAY ({{$today.minus({days: 0}).toLocaleString({ day: ‘numeric’, month: ‘long’, year: ‘numeric’})}})\nImpressions: {{ $json["Yesterday Ipressions"] }}\nFrequency: {{ $json["Yesterday Frequency"] }}\nCTR (link clicks): {{ $json["Yesterday CTR"] }}\nUnique link clicks: {{ $json["Yesterday link clicks"] }}\nCPC: {{ $json["Yesterday CPC"] }}\nLeads: {{ $json["Yesterday leads"] }}\nCost per lead: {{ $json["Yesterday CPL"] }}\nLPCR: {{ $json["Yester LP CR"] }}\nAmount spent: {{ $json["Yesterday adspend"] }}\nCpm: {{ $json["Yesterday CPM"] }}\n\n”,
“options”: {}
},
“id”: “12391c46-1724-47fd-8393-b6f1807a9fc9”,
“name”: “Discord2”,
“type”: “n8n-nodes-base.discord”,
“typeVersion”: 2,
“position”: [
1320,
1100
],
“credentials”: {
“discordBotApi”: {
“id”: “3TGl73tLi7cHrE7O”,
“name”: “Discord Bot account”
}
}
}
],
“connections”: {
“Daily Client Stats Scheduler”: {
“main”: [
[
{
“node”: “Get monday item | Daily Client Stats”,
“type”: “main”,
“index”: 0
}
]
]
},
“Get monday item | Daily Client Stats”: {
“main”: [
[
{
“node”: “Split In Batches”,
“type”: “main”,
“index”: 0
}
]
]
},
“Split In Batches”: {
“main”: [
[
{
“node”: “Google Sheets”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Sheets”: {
“main”: [
[
{
“node”: “Item Lists1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Item Lists1”: {
“main”: [
[
{
“node”: “Discord2”,
“type”: “main”,
“index”: 0
}
]
]
},
“Discord2”: {
“main”: [
[
{
“node”: “Split In Batches”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {}
}

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@pkovereng , as I understand the source of your data is actually Google Spreadsheet (as opposed to Facebook) - that is the data from spreadsheet is relayed to Discord. Therefore, the data output depends on the data formatting in the spreadsheet and the settings of your Google Sheets node.

If you have the data in the spreadsheet formatted as “Percent” and “Currency” already then the Google Sheets node should be set up as per the screenshot below. At the moment, you use the default formatting - that is unformatted data.

.

If for some reason you cannot have Google spreadsheet formatted to your liking, then you would have to do it in your workflow. Something like this, {{ ($json["Yesterday CTR"] * 100).toFixed(2) + '%' }} or {{ $json["Yesterday CTR"].toLocaleString("en", {style: "percent"}) }}. When it comes to currency, you can use {{ $json['Yesterday adspend'].toLocaleString("en", { style: "currency", currency: "USD" }) }}

1 Like

Wonderful, thank you so much for the answer!

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