Spreadsheet File text length limit for xlsx?

Describe the issue/error/question

The Spreadsheet file node produces an error when trying to save xlsx, but not xls. The error message is
"Problem in node ‘Spreadsheet File’
Text length must not exceed 32767 chracters
image

The same output (around 0.5MB) can be saved as .csv or .xls (old format)

Information on your n8n setup

  • n8n version: 0.202.1
  • Database you’re using (default: SQLite): Postgres
  • Running n8n with the execution process [own(default), main]: main
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker

Hi @Bahadur, I am sorry to hear you’re having trouble.

I just tried reproducing this problem using the below workflow but didn’t run into trouble here (neither on [email protected] nor on the current version 0.207.1). That’s despite having a 5 MB file in the end:

Workflow:

So I don’t think this is a problem with the file size or the n8n node but rather a limitation of the desired file format. The XLSX format as defined by Microsoft only allows up to 32,767 characters in a cell:

Total number of characters that a cell can contain: 32,767 characters

So perhaps you want to truncate your field data before writing it into a XLSX file?

You are right @MutedJam , I didn’t really notice the length of the data…

But here’s a followup question; the input to spreadsheet file node is the same for XLS, CSV and XLSX, it is a string in a comma separated format.
How come that CSV and XLS outputs split this data properly and output cells with have much less than 32k data, but XLSX mode treats this as a whole

replaced most chararacters with X for privacy…
[
{
“data”:
“xxxx,xxxxx,xxxxxx,xxxx,xxxx xxı,xxxx xxxx,xxxx xx,xxxx xxxxxxx,xxxx xxxx,xxxxx xxxx xxxxxx,xxxxxx,xxxxxxxxxxxxx xxxxxx,xxxxxx,xxxxxx,xxxx xx,xxxx,x,xxxxxxşxxxıx xxxx xx xxxxxxxxıxxxx xxxxxı xxşxxxüx xxxxxx xxxxxxxxx xüxxx xxxxxxxx xxx xxx,xxxx, xxxxxxxxıx xxxxxxx xxxxxxxx xxxxxxxxxxxx.,xx.xx.xxxx,xxxxxx, xxxxxx,xxxxxx,xxxxxx,xxxx x,xxxx,x,öxxxxxx xxxxxx xxxışxxxı xxxx xxx çxx xxxxxxxxx. xxxxxxx xüx xxxxxxxxx öxxxxxx xxxxxıxx xxxxxxxx .,xxxx, xxxxxxxxıx xxxxxxx xxxxxxxx xxxxxxxxxxxx.,xx.xx.xxxx,xxxxxx, xxxxxx,xxxxxx,xxxxxx,xxxx xx,xxxx,x,xxxxıxxxxxxx xüxüxxx xxxxxx xx çxx xxxxıxıxxı. xxxxxxxx xx xıxxı şxxxxxx çöxüxx xxxşxıxxıxxx.,xxxx, xxxxxxxxıx xxxxxxx xxxxxxxx xxxxxxxxxxxx.,xx.xx.xxxx,xxxxxx, xxxxxx,xxxxxx,xxxxxx,xxxx xx,xxxx,x,xxxıx xxxx xxxxx xxxx xxxxx xxxx çxx xxşxxxüx xxxxxx xxxx xx xxxxxxxxıxxxx xxxxx”
}
]

extra information; my data seems to be multiline in n8n editor, but it is output as single line in the spreadsheet file.

i think it is split with \n in my input, what’s the proper replace character ? \r\n didn’t seem to work

this is the input and on the right side is the output


but when I export and open the CSV I see
image

when I export and open XLSX I see

Hi @Bahadur, your input looks like a single long string. So you’re probably right about having to split it.

I am not 100% sure how exactly your data looks like as n8n does not display line breaks in JSON view. However based on your description I suspect something like this would do the job:

This first splits up your data into rows on newlines (\n), then each row into fields using the comma , (and trimming any additional spaces).

If that’s not it, could you copy the raw JSON data from your input data so I can have a go at it? In the JSON view, you can do so by first selecting the level you want to copy from (by clicking in the empty space of the respective line) and then selecting Copy Selection from the respective menu:

oh my, with n8n its soo easy when someone adept at JS (more than me) shows the solution :smile:

thanks for the solution @MutedJam it works 100%

1 Like

Glad to hear, thanks so much for confirming!

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