Describe the problem/error/question
Hello! I’m trying to use n8n to export some different data feeds in a specific format. When I write items with a long number (i.e. 12984760385) to a CSV using the Spreadsheet node, it automatically shortens the number using scientific notation (i.e. 1.29847E+5) irreversibly. I would export it as an XLS or XLSX which seems to avoid this, but I cannot use the “append” feature.
Is there any way I can disable or override this functionality?
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
n8n version: 0.225.2
Database (default: SQLite): SQLite
n8n EXECUTIONS_PROCESS setting (default: own, main): Not sure?
Running n8n via (Docker, npm, n8n cloud, desktop app): npm
Operating system: Fedora 37
Hi @jv_junkbrands, welcome to the community!
I am sorry you’re having trouble. Unfortunately, you didn’t share the exact dataset returned by your “Process Products” node and I couldn’t reproduce this problem with the exact number you have used.
This would also prevent any formatting in spreadsheet files. Try out the below example (you might need to adjust the file path to match your file system):
You can see how the numeric value is written using the scientific notation, but the “string” value remains unchanged:
So perhaps you can adjust your workflows behind “Process Products” in a way that it returns a string instead of a number? In many cases simply appending
.toString() (MDN) to the expression writing the number would do the job.
Hey @MutedJam, thank you for the welcome and assistance!
Apologies for not including more of the dataset, I was rushed when putting this request together yesterday and can include more if you feel that would help future users.
That said, your suggestion of using
.toString() on the numbers seems to have worked perfectly. I’m loading the data into “string” fields within the Set node, which I thought would automatically convert the data a string, but apparently not. By manually converting it to a string using
toString(), it seems to be outputting correctly.
Amazing, great to hear it did the job for you. Thanks for the confirmation!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.