Link google sheets to a slider in after effect
-
Hello,
I need helpI’am using Templater with after effect and I would like to use a database like google sheet to link value to a slider in after effect.
I think I must use expression script…. But… I dont know…
Is somebody have a issue for me ?Thanks a lot
Jean-Michel
-
Hi Jean-Michel, we are working on adding a new feature that will make this easier, but in the meantime, if you want to access a value from your data, you need to connect the value to a text layer, then enable expressions for the slider and connect the slider to the
sourceText
value of the text layer, and wrap it inparseInt()
to convert the string to an integer that the slider control effect can read. It would look like:parseInt(comp("your comp name").layer("your text layer name").text.sourceText)
-
yes !..thank you ;-))
-
@jon
Was this ever successfully built into new versions of Templater? I can’t figure out how to make your expression from 2018 work between Google Sheets and my Templater slider control layer. First of all, is the slider control layer meant to be different from the text source layer?Thank you.
-
@ryan We did add an experimental feature to allow you to import job data from your Google Sheet to a JSON file within your project, which you could then use by referencing that data in expressions on any layers or effects that support expressions. There is an issue, though, that Adobe has yet to address, where the changes to the JSON throw an error that interrupts Templater, making this feature not very usable at the moment. There was at least one report on Adobe’s UserVoice feedback portal in 2018, but they have yet to acknowledge the problem. I’d recommend upvoting the issue for more visibility. Hopefully they will eventually fix it, but it’s been frustrating that we haven’t been able to get their attention thus far, as it would really improve the workflow for managing data-driven video.
For the time being, you can map the data to a text layer in your project, as mentioned. This support article explains both methods. (note the warning in “JSON Footage” section, which repeats what I said above).
Where you put the slider depends on what you’re doing with it. You apply the expression to the slider value. The expression is getting the data from a text layer somewhere in your project—you would need to change the placeholder values in the expression to reference your comp name and the layer name of your text layer within that comp.
-
@ryan quick follow up to note, you can’t use the value to set the value of a keyframed animation, as expressions cannot control individual keyframes. Also, if you are applying a Slider Control and the Templater Settings effect to the same layer, make sure that the Templater Settings effect is at the top of the Effects Control panel effects stack, and drag the effects to reorder them if they are not in the correct order.
-
@jon Ah, so I can not animate the slider from zero to 5 and have Templater render the next video from zero to 6, the next from zero to 7, etc. Oh well, thank you for your response.
-
@ryan you can animate the slider with that data, but it needs to be done entirely with expressions instead of keyframes. It’s not possible to mix the two.
-
I experimented with using an expression to animate a slider, and I think I might have come up with something that’ll work, at least on a basic level.
You’ll want to start by adding a value to your data source to control the end value of the slider. I used
endvalue
for this example. You’ll then want to create a new text layer, rename it to “endvalue” (with no quotes), and apply the Templater effect. This will allow you to control the upper value of the slider expression using values from the data source.You’ll then want to add another variable to indicate the duration of the expression. You could use another variable from your spreadsheet using the same method outlined above or something static. For this example, I used the comp duration.
Once that’s done, add this expression to your Slider:
endvalue = parseInt(thisComp.layer("endvalue").text.sourceText.value); totaltime = thisComp.duration; Math.floor(linear(time,0,totaltime,0,endvalue))
The linear expression will cause the value of the slider to change over time (the first variable), starting with 0 (the second variable) and ending at
totaltime
(the third variable). The slider’s value will start at 0 (the fourth variable) and end atendvalue
(the fifth variable).This should allow you to input a variable in your data source that controls the end of the slider the way you described above. You won’t be able to control the value with keyframes directly, but if you’re looking for the slider to advance in a linear fashion, this should do it.
Hopefully, that helps.
-
@jeff Yes! This is it! Thanks, everyone.