Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Problem with CSV [invalid text layer]

  • Problem with CSV [invalid text layer]

  • Fabrice Leconte

    January 5, 2021 at 1:17 pm


    I wrote an extendScript to get values from a CSV file.

    My CSV file looks like this:


    44,Lewis Hamilton,United Kingdom,MERCEDES,1'27.866,#00d2be

    33,Max Verstappen,Netherlands, RED BULL RACING HONDA,+0.213,#0600ef

    55,Carlos Sainz,Spain,MCLAREN RENAULT,+0.264,#ff8700

    11,Sergio Perez,Mexico,RACING POINT BWT MERCEDES,+0.289,#f596c8

    3,Daniel Ricciardo,Australia,RENAULT,+0.302,#fff500

    16,Charles Leclerc,Monaco,FERRARI, +0.455,#dc0000

    10,Pierre Gasly,France,ALPHATAURI HONDA,+0.521,#ffffff

    if I type:

    var datas = app.project.activeItem.layer("F1 Starting Grid.csv")("Data")("Outline");

    alert(datas("number")("number 0").value);

    it returns 44

    That’s OK, but if I type:

    var datas = app.project.activeItem.layer("F1 Starting Grid.csv")("Data")("Outline");

    alert(datas("name")("name 0").value);

    // I have an error:

    // Unable to execute script at line X After Effects error: invalid text layer

  • Brendon Murphy

    January 7, 2021 at 5:09 am

    I haven’t tested these out, but my guess is that “value” can return numbers, but not text strings. You might try dropping the “.value”,and/or using a toString conversion.

  • Filip Vandueren

    January 7, 2021 at 9:16 am

    Yep, looks like that’s a serious bug.

    Anything that’s not a number is of type “Text-Document” and apparantly when extendScript wants to find the value of a TextDocument, it expects that to be inside of a textLayer and trips up.

    I can’t find a way around it other than parsing the whole csv yourself in extendscript using a library like babyparse or papaparse.

    Best to submit it as a bug with adobe

  • Fabrice Leconte

    January 7, 2021 at 6:34 pm

    Yes, probably a bug.

    Finally, I created a temporary text layer to store the value by adding an expression on it:

    "footage('F1 Starting Grid.csv').dataValue([0,0]);"

    and then I removed the temporary text layer when I don’t need.

    That’s weird but it works. ^^

Viewing 1 - 4 of 4 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy