This should give you a place to start. Becasue the quotes contain commas you will need to save the Excel sheet as tab delimited instead of csv. You also will need to change the file paths to match your system.
function makeActiveLayerByName( lyrname ){
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putName( charIDToTypeID( "Lyr " ), lyrname );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putBoolean( charIDToTypeID( "MkVs" ), false );
executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
};
function SaveAsPNG( saveFile ){
pngSaveOptions = new PNGSaveOptions();
pngSaveOptions.interlaced = true;
activeDocument.saveAs( saveFile, pngSaveOptions, true, Extension.LOWERCASE );
};
// you will need to change the file paths
var dataFile = new File('~/desktop/ZenAwake - Quotes.txt'); // tab delimited text file
var shortTemplate = new File('~/desktop/Short Quote.psd');
var medTemplate = new File('~/desktop/Medium Quote.psd');
var longTemplate = new File('~/desktop/Long Quote.psd');
var tagline = 'Daily Inspiration #';
var lines = [];
dataFile.open('r');
while( !dataFile.eof ){
lines.push( dataFile.readln() );
}
dataFile.close();
var numberOfQuotes = lines.length;
for( var quoteIndex = 1; quoteIndex < numberOfQuotes; quoteIndex++ ){
var quoteArray = lines[ quoteIndex ].split( '\t' );
var quoteNumber = quoteArray[0];
if( quoteNumber == '' ) continue;
var quote = quoteArray[1];
var quoteLength = quote.length;
var speaker = quoteArray[2];
switch( true ){
case ( quoteLength <= 50 ):
app.open( shortTemplate );
break;
case ( quoteLength >= 151 ):
app.open( longTemplate );
break;
case ( quoteLength > 50 && quoteLength <= 150 ):
app.open( medTemplate );
break;
}
makeActiveLayerByName( 'ID#' );
app.activeDocument.activeLayer.textItem.contents = tagline + quoteNumber;
makeActiveLayerByName( 'quote' );
app.activeDocument.activeLayer.textItem.contents = quote;
var quoteBottom = app.activeDocument.activeLayer.bounds[3].as('px');
if( speaker != '' ){// speaker not blank
makeActiveLayerByName( 'speaker' );
app.activeDocument.activeLayer.textItem.contents = speaker;
var speakerTop = app.activeDocument.activeLayer.bounds[1].as('px');
if( (speakerTop - quoteBottom ) != 40 ){
app.activeDocument.activeLayer.translate( 0, ( quoteBottom + 40 ) - speakerTop );
}
}else{// hide speaker layer
makeActiveLayerByName( 'speaker' );
app.activeDocument.activeLayer.visible = false;
}
// you may want to change path and naming
var saveFile = new File('~/desktop/temp/ZenAwake - Quotes #'+quoteNumber+'.png');
SaveAsPNG( saveFile );
app.activeDocument.close( SaveOptions.DONOTSAVECHANGES );
}