Welcome! This repository is a growing collection of example workbooks demonstrating how to use Python directly in Excel, with a focus on survey research applications.
New to this? Then click the image below to go to our training video on YouTube. Recorded for the Association for Survey Computing on 11 July 2025
Each file showcases a different technique or analysis:
-
☁️ Wordcloud app
In the Getting started directory, you’ll find a step-by-step tutorial to build your own Word Cloud app.- Training version: Practice assembling the Python code yourself.
- Wordcloud - complete: The fully working version to review or adapt.
-
📊 Bar charts with sig arrows.xlsx
Create bar charts that include significance arrows, useful for survey reporting. -
📈 Example charts.xlsx
Same data, different visualisations - choose from radar charts, bar charts, heatmaps and line charts -
📝 Fixing encoding issues.xlsx
Techniques to clean and fix text encoding problems in your data. -
💬 Sentiment Analysis.xlsx
Analyse open-ended responses using Python-based sentiment scoring. -
🔍 Fuzzy Logic Matching.xlsx
This workbook demonstrates how to use fuzzy matching algorithms to semi-automate the coding of open-ended survey responses. It compares each free-text answer to a reference list, returning the best and second-best matches with similarity scores. Confident matches can be auto-coded, while ambiguous ones are flagged for manual review – reducing workload while maintaining accuracy. -
🧭 Polar Histogram.xlsx An advanced example showing how to create polar histograms within Excel using Python and Matplotlib. Inspired by Oscar Leo’s tutorial on Medium, this demonstrates circular data visualisation techniques for complex analytical tasks.
-
⚖️ RIM Weighting.xlsx Calculating survey weights is a common task, RIM weighting is a way of calculating the weight through iterations of gradual improvement
-
⚖️ Generate Fake Data.xlsx Need some fake data, generate what you need in multiple languages
-
🧪 Synthetic Data Generation.xlsx Demonstrates how to use machine learning to generate synthetic data for missing survey responses. In this quick example, values are created for respondents who did not see a question due to a survey error, showcasing a practical approach to filling gaps for analysis.
-
🌸 Pair Plot – Iris Dataset.xlsx An example demonstrating how to create a pair plot using the classic Iris dataset. Pair plots visualise relationships between multiple numerical variables, helping to identify patterns, correlations, and class separations within the data. Source: The Iris dataset was introduced by R.A. Fisher (1936) and is widely available in data science libraries such as scikit-learn.
-
🌳 Machine learning for predictive models An interactive example demonstrating machine learning in Excel. Users input sepal and petal measurements, and a trained decision tree model predicts the Iris species directly within the workbook. Whilst not directly related to survey data, it is an example of how we could do segmentation
-
📱 QR Code Generator.xlsx
An example showing how to generate QR codes within Excel using Python. This builds on Microsoft’s example, demonstrating practical uses for creating quick links or survey access codes directly in your workbooks.
More examples are on their way to help you integrate Python seamlessly into your survey workflows and everyday Excel tasks.
💡 Why use Python in Excel?
Using Python in Excel unlocks powerful analysis, visualisation, and automation capabilities while staying in the tool you already know.
Contributions are very welcome!
If you have:
- An idea for a new example
- Improvements to existing workbooks
- Bug fixes or clarifications for the tutorials
Please:
- Fork this repository
- Make your changes or additions
- Create a pull request describing what you’ve done and why
Alternatively, feel free to raise an issue with suggestions, questions, or requests for new examples.
Explore, adapt, and start supercharging your Excel workbooks today!