Change variable value for different shortcode attributes?

It seems that you might have a lot of these .csv files. I would suggest to use only one attribute and then passing the appropriate name to that attribute or the prefix of the file name and then building the file name from there.

You can try one of the following (I have not done any verification, you will propbably check that the attribute is not empty and that the file exists before returning anything in the shortcode)

OPTION 1

Passing the complete file name (my personal choice)

add_shortcode( 'open_file', 'custom_file' );
function custom_file( $atts )
{
    $attributes = shortcode_atts( array(
        'file' => '',
    ), $atts );

    return $attributes['file'];
}

Use it then as follow

[open_file file="ex1.csv"]

OPTION 2

Passing the prefix to the attribute

add_shortcode( 'open_file', 'custom_file' );
function custom_file( $atts )
{
    $attributes = shortcode_atts( array(
        'file' => '',
    ), $atts );

    $filename = $attributes['file'] . '.csv';
    return $filename;
}

Use it then as follow

[open_file file="ex1"]

By doing it with either of the above methods will eliminate a very long and unnecessary if/else statement