Hi Michael L Hale,
Sorry for asking so much, but don't understand very well how to implement your example (I'm a beginner with photoshop scripting). Would it bother you to post a specific example of your function? I'd appreciate it so much. 
Let's say that the csv file is always on the desktop( you could use a different folder ). With the doc with the datasets that need updating open run the script below. It does the same thing as File-Import-Variable Data Sets except that it sets the csv file without the dialog. You can even use it as part of your action.
BTW, if you import from the Image-Variables dialog's flyout menu scriptlistener doesn't output anything. You have to use File-Import-Variable Data Sets. That will get you to the same dialog and scriptlistener output.
var myCSVFile = new File('~/Desktop/myCSVFile.csv');
fileImportDataSets( myCSVFile );
// Imports a csv file using the first field as the dataset name
// the first field should be unique as it will be used to index the datasets for
// loopDataSets and applyDataSets functions
function fileImportDataSets( file ) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( stringIDToTypeID( "dataSetClass" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putPath( charIDToTypeID( "Usng" ), new File( file ) );
desc.putEnumerated( charIDToTypeID( "Encd" ),
stringIDToTypeID( "dataSetEncoding" ),
stringIDToTypeID( "dataSetEncodingAuto" ) );
desc.putBoolean( stringIDToTypeID( "eraseAll" ), true );
desc.putBoolean( stringIDToTypeID( "useFirstColumn" ), true );
executeAction( stringIDToTypeID( "importDataSets" ), desc, DialogModes.NO );
}