psychopy.org | Reference | Downloads | Github

Excel Macro-Enabled Workbook (.xslm) for "Conditions" in Builder?

I tried to load a sheet from an Excel Macro-Enabled Workbook (.xslm) for “Conditions” in the Builder. But It is mentioned the following: “No parameters set (conditionsFile not found)”. It only works when I have the same sheet (without any macros).

My question: is it possible to use a sheet from .xslm (an excel sheet with macros)?

Hi @mmolet, currently, PsychoPy supports xls, xlsx, csv and pickled file formats. Are you able to convert your xlsm to an xlsx format?

Yes, I can convert it, but I was wondering whether Psychopy could read it. Is there any suggestion to make it possible?

It could be added to a release, but see also the GitHub post and comments by Richard and Jon.

If you want to add the option yourself, there is an easy way to enable to PsychoPy to recognise the .xlsm file, but it involves you tweaking the PsychoPy code. If you are comfortable with that, and are confident the macros are safe in your Excel file, you need to open psychopy/data/utils.py and goto line 273. This should have the following conditional:

if fileName.endswith('.csv') or (fileName.endswith(('.xlsx','.xls'))
                                     and haveXlrd):

If you want to have xlsm files recognised, change this line to the following:

if fileName.endswith('.csv') or (fileName.endswith(('.xlsx','.xls','.xlsm'))
                                     and haveXlrd):

If you are using the standalone version, you probably do not have permission to change the file in place. So, to get around this, copy the file to desktop, change the file, and paste the file back in the original location.

Thanks dvbridges. My apologies for the “silly” question but how can I open psychopy/data/utils.py? (i.e.,location). Yes I use the standalone version (for Mac).

No it is not a silly question, I nearly put that info in but chose not to :smile: If you are using a Mac, perhaps you have BBEdit? Open the file with BBEdit, or some other text editor.

where can I find the file: psychopy/data/utils.py? thanks in advance

That is the path, so you need to find where your version of PsychoPy is installed, and follow that path toi the util.py file (.py is a Python file extension).

If you would like to wait for the next release, I am just putting in a pull request on GitHub to fix this.

most excellent, yes! this is very kind of you.

No problem, see the link below for the fix:

I don’t know where PsychoPy is installed and thus I am unable to follow the path you indicated to me, all this is very new to me…

Ok, well if you can wait, then this will be in the next bug fix release (3.0.6) - @jon is making new releases quite regularly whilst we get the PsychoPy 3 running smoothly online, so you should not have to wait too long.

Since you mentioned Mac; just find the psychopy icon in your applications folder, CTRL+click on it and click on “Show Package Contents”. It still takes some navigation from there, but for example my path is /Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/data/utils.py.

Or use the CMD-SHIFT-G shortcut in Finder and paste the path there.

Hope this helps.

Yes it does! Thanks.