Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to retrieve Limesurvey (version 3.x) data from Power BI desktop on Windows

  • mcovents
  • mcovents's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 6 months ago #216979 by mcovents
I hope this info helps someone.

1) - Install Python www.python.org/downloads/windows/
- Install Git for Windows git-scm.com/download/win
Leave the default settings. Allow both installation programs to set the PATH environment variables.
- Run a Command prompt by clicking on the Windows icon and type "cmd". Click on the "Run as Administrator" option on the right.
- Check if Git is installed by running the line below in this command prompt
git --version
This should print the version (for example git version 2.31.1.windows.1)
- Check if Python in installed by running
py -- version
This should print the version (for example Python 3.9.1)
2) Run the following in the command prompt (copy each line and press enter after each):
pip install pandas requests matplotlib
pip install git+https://github.com/ESchae/limesurveyrc2api

3) - Download the script (limesurvey-powerbi.py) from Adam Zammit
github.com/adamzammit/limesurvey-powerbi-python
- Update the script to include your LimeSurvey JSON-RPC URL (Configuration - Global settings - Interfaces), username, password and survey id
line 8 upto 11
- Make sure the JSON-RPC interface is enabled on your Limesurvey installation.
4) Run the script from the Power BI desktop using Data Import then "Python Script"
If you get an error <pi>KeyError: 'Token'</pi> this means that the name of the field "Token" in the surveydata table on which the script is trying to merge the data is different on your Limesurvey installation. For example in my language (dutch) it was 'Toegangscode'. I had to change line 39
Old line
mergeddata = tokendata.merge(right=surveydata,how='outer',left_on='token',right_on='Token')
New line
mergeddata = tokendata.merge(right=surveydata,how='outer',left_on='token',right_on='Toegangscode')


 
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #217016 by holch
Thanks for writing this up. Unfortunately, in the forum it will probably get lost over time.

I think the best place for this would be in the manual.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 6 months ago #217105 by DenisChenu
www.limesurvey.org/manual/RemoteControl_...hon_example_and_glue

I don't think we need to create part for «How to install python on windows» for example …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
2 years 11 months ago #223277 by pgaljan
This is really helpful thank you!  I'm running into an issue when I try to load the script into PBI:

This being my first time trying this, I'm not sure where I should start troubleshooting.  I've reinstalled numpy, and installed mkl-service via pip. 

Any ideas you have as to where to look next would be very much appreciated!

Details: "ADO.NET: Python script error.
<pi>C:\Users\<user>\anaconda3\lib\site-packages\numpy\__init__.py:143: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see github.com/IntelPython/mkl-service
  from . import _distributor_init
Traceback (most recent call last):
  File "PythonScriptWrapper.PY", line 2, in <module>
    import os, pandas, matplotlib
  File "C:\Users\<user>\anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
    raise ImportError(
ImportError: Unable to import required dependencies:
numpy: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.8 from "C:\Users\<user>\anaconda3\python.exe"
  * The NumPy version is: "1.20.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

</pi>"

The topic has been locked.
More
2 years 11 months ago #223278 by pgaljan
I self-resolved this by selecting the right python install in File>Options & Settings. Hope this helps if someone else runs into a similar issue. Thanks for this solution. It works great!
The following user(s) said Thank You: DenisChenu
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose