Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by


NikkieKNikkieK Posts: 12

Hello Daniel,
I am unable to install Datamerger on my system. I am using Ubuntu 16.04 and i followed the steps mentioned. It says "unable to locate package datamerger". How do i install it?

Thank you!


  • sebastiaansebastiaan Posts: 2,563

    Hi Nikkie,

    The DataMerger is quite outdated by now. Below is a simple script that allows you to do more or less the same thing. The way it works:

    • Add all .csv files that you want to merge to the OpenSesame file pool
    • Add this script as an inline_script item
    • In the inline_script item, select all text, and click on the 'Run selected text' button. (So don't run the experiment itself!)
    • You will then find the merged files in the file pool

    I'll see if I can turn this into a simple extension to make it easier.


    import os
    from datamatrix import io, DataMatrix
    # This points toward the file pool if you run the script from within OpenSesame
    # by selecting the script and clicking on the 'Run selected text' button.
    # This will *not* work when running as an experiment, or as a standalone script.
    DIRNAME = opensesame.experiment.pool_folder
    dm = DataMatrix()
    # Loop through all files in the source directory
    for basename in os.listdir(DIRNAME):
        # Skip files that aren't csv or start with merged (because that's the
        # output file)
        if not basename.endswith('.csv') or basename.startswith('merged'): 
            filedm = io.readtxt(os.path.join(DIRNAME, basename))
        except Exception as e:
            print('Failed to open %s (Exception: %s)' % (basename, e))
            # Add a source column, and then concatenate the input file and the full
            # DataMatrix
            print('Read %s' % basename)
            filedm.source = basename
            dm <<= filedm
    # Save to the source directory as both csv and xlsx
    io.writetxt(dm, os.path.join(DIRNAME, 'merged.csv'))
    io.writexlsx(dm, os.path.join(DIRNAME, 'merged.xlsx'))

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

Sign In or Register to comment.