Power QueryExercises

Read a fixed-width text report (parts)

An old system writes each record as fixed-width text. Cut each line at the right positions and type the result.

Level
advanced
Time
~12 min
Task
Build the query
Access
Free — no account needed
Loading the practice workspace…

About this exercise

What you'll practise

Split text by character positions and clean the padding that fixed-width formats add.

Ironbridge Engineering (fictional) still prints its parts inventory from a 1990s system as fixed-width text.

Steps

  1. ReportFile is a text file with one record per line and no header. Characters 1–6 are the code, 7–26 the name (padded with spaces), and 27–31 the quantity (right-aligned).
  2. Produce columns Code, Name and Qty, with surrounding spaces removed from every value.
  3. Set Qty to a whole number.

Your result must

  • Columns: Code, Name, Qty
  • No padding spaces in Code or Name
  • Qty is a whole number

Input

  • ReportFile (file)
    • Text file; first line: P0001 Spring Pin Set 180
    • Every field is text until you set types

Expected output columns

Code (text), Name (text), Qty (number)

First 3 of 7 expected rows
CodeNameQty
P0001Spring Pin Set180
P0002Flat Bolt867
P0003Flat Washer125