Forums › Adobe After Effects Expressions › Carriage Return in CSV linked data?
Carriage Return in CSV linked data?
Paul Connors
March 2, 2021 at 10:00 pmHello. I’m looking for a way to include a carriage return in a spreadsheet cell (CSV) that I can link to an After Effects project. I essentially want to be able to have two names stacked on top of each other in one spreadsheet cell and therefore in one text layer in AE. Each time I try to add a carriage return in the CSV file it breaks the data connection on the AE side. I’ve done a bunch of research online as well, but haven’t been able to find any answers, hence posting in this forum. Any help would be greatly appreciated. Thank you!
Dan Ebberts
March 2, 2021 at 10:08 pmI guess you could use a character in the spreadsheet that wouldn’t otherwise appear in your text (like “|” maybe) to indicate a carriage return and then replace it with an actual carriage return in your text expression.
Kevin Camp
March 2, 2021 at 10:18 pmIn the spredsheet cell, are there two names in the cell. like ‘John Doe’?
If so, you could parse the sourceText for that text layer and replace the space with a carriage return.
Here is a simple expression to do that:
txt = value.split(" ") ;
txt[0] + '\r' + txt[1]However this may not work if there is more than two words in the cell… ex: ‘John Doe Smith’.
If you can insert a less common character in the spreadsheet to use to determine the break it would give you better control… like add a ^ where you want the break, then change the expression like this:
txt = value.split("^") ;
txt[0] + '\r' + txt[1]Trent Armstrong
March 3, 2021 at 5:34 pmCan you put \r in your CSV file where you need carriage returns and have that just flow through to AE?
Log in to reply.