Home › What We Do › Data cleaning & conversion

Case study · Science & Research

How we built an Excel macro that turns raw instrument text files into research-ready data

A research laboratory studying the effects of pollution on stabled horses had their results locked in awkwardly formatted text files from their sensors. We built an Excel tool that reads a whole file at the click of a button and lays out every test as one tidy row, ready to analyse and prepare for publication.

Client
Research laboratory studying equine health
Built with
Excel, VBA
Project size
3 hours, fixed price
Delivered in
2 days from go-ahead

Need Something Similar?

Describe your problem for a free, fixed-price quote within 24 hours.

We reply within 24 hours and treat all client data as sensitive. See our privacy policy.

The Challenge

The laboratory had been studying how pollution affects horses kept in stables. The experimental work was finished, and the team was preparing their findings for publication in a scientific journal.

The raw data came from particle sensors, downloaded as text files laid out for the equipment rather than for analysis. Each file held hundreds of tests. For each test the sensors recorded a date, a time, a test ID and minimum, maximum and average readings for each particle size, but not in a form Excel could sort, filter or chart.

The researchers wanted to bring the sensor readings into Excel and combine them with environmental data for their analysis. Copying hundreds of tests by hand would have been slow, and in published research every transcription error is a risk.

Scoping: A Fixed Price the Same Morning

The researcher phoned us late on a Friday morning and sent over a sample text file and the spreadsheet layout the team wanted. After a short call, we confirmed the scope in writing about 20 minutes after the enquiry came in. It was a fixed price of 3 hours, with the finished tool promised for the start of business the following Tuesday. The client approved it that afternoon. The scope was:

  • a spreadsheet that fills the researchers' chosen layout from the sensor text files
  • the date, time, test ID and minimum, maximum and average particle readings for every test in a file, each test on its own row of a conventional table
  • a single button: the user clicks it and picks the text file to process
  • built for Windows versions of Excel from 2007 onwards

The researchers' layout gave each particle size its own columns. That repeats some information on every row, but it was the layout they needed for their analysis, and once the data is in a table the number of rows and columns doesn't matter. What mattered was getting every reading out of the raw files reliably.

What We Built

  • One button, no other steps. The user clicks Get Data, chooses a text file and the tool processes the whole file to the end without any further input.
  • One row per test. Every test in the file becomes a single row with its date, time, test ID and the minimum, maximum and average for each particle size, finishing with the overall maximum.
  • No copying, pasting or formulas. The data goes straight from the raw file into the table. There is no sheet where someone pastes data in, and no formulas that could be overwritten or broken.
  • A layout the team can change. The tool finds each column by its heading rather than its position. Researchers can add their own columns, such as environmental readings, alongside the sensor data, as long as the date stays in the first column and the overall maximum in the last.
  • Ready to use straight away. We delivered the file with all 801 tests from the team's sample file already converted, so they could check the output against their own records before running new files.

Why We Automated the Whole Process

A common way to tidy raw data is a "processor" sheet: someone pastes the raw text in, and formulas pull the numbers out. It works, but every paste is a chance to miss a row or paste into the wrong place, and formulas can be overwritten without anyone noticing.

Data integrity is vital in research, so we took people out of the process entirely. Every file is read the same way, every time, from the original export. If the team needs to re-run a file, or a reviewer asks how a figure was produced, the answer is the same button and the same raw file.

The Result

801 testsfrom the sample file, converted in one click
2 daysfrom go-ahead to the finished tool, ahead of the agreed date
3 hoursfixed-price development

The researchers could turn each sensor export into a clean table in moments, ready to combine with their environmental data and analyse for publication. Nothing is typed or pasted by hand, so every row can be traced back to the original file.

Why Excel, and Not Python or R?

Scripting languages such as Python and R are excellent for large, ongoing data pipelines, and many research groups use them. This team worked in Excel, wanted the results in Excel, and needed a tool any member could run without writing or maintaining code. A button in a spreadsheet met that need for a few hours' work.

Newer versions of Excel also include Power Query, which can import many text formats without any code. For files where each test is spread across several lines, as here, a short VBA routine gives more control over exactly how every value is picked out. The tool runs in desktop Excel for Windows.

Could This Work for Your Organisation?

The same approach suits anyone whose equipment exports data in an awkward format: research and university laboratories, environmental monitoring, manufacturing quality control, engineering test rigs and data loggers of all kinds. If your team copies readings out of text or CSV files before it can start analysing them, a one-click converter usually pays for itself the first time it is used. Send us a sample file and the layout you want, and we can usually get back to you with a fixed price within 24 hours.

Questions About Importing Instrument Data Into Excel

Can Excel import data files from laboratory instruments and data loggers?

Yes. Most instruments export text or CSV files, and Excel can read them. When the layout is awkward, for example with each test spread across several lines, a VBA macro or Power Query can turn it into a table with one row per test.

How many tests or readings can it handle?

Thousands. This tool converted the 801 tests in the team's sample file in a single run, and Excel worksheets hold over a million rows. For very large or continuous data, we'll tell you on the scoping call whether a database would suit you better.

Will it break if we change our spreadsheet layout?

Not if it is built to find columns by their headings, as this one was. You can add your own columns or rearrange the existing ones, within a few simple rules that we explain when we hand the file over.

Why not just paste the data into a sheet with formulas?

Pasting and formulas can work for a one-off job, but every manual step is a chance for error, and formulas can be overwritten without anyone noticing. A button that reads the original file directly gives the same result every time, which matters when data has to stand up to scrutiny.

What does a data converter like this cost?

We quote a fixed price after a free scoping call, and you only pay once you are happy with the finished work. This project was completed before AI. With its assistance in parsing the raw instrument files, we believe a similar project could now be delivered for $300–$400.

Have a Spreadsheet Problem Like This?

Describe it in a few lines. We'll reply with a fixed-price quote within 24 hours.

Get my free quote