How to Parse Structured Text Logs with Power Query in Excel
Question details
The user needs to extract specific data fields such as time, cell ID, carrier index, reference signal, receiver port, and SNR values from structured text or CSV log files.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Importing and transforming structured telecom log files to extract and map specific network metrics for data analysis.
- Observed behavior
- The raw text logs need to be parsed correctly, separating individual records into fields and mapping receiver ports 0 through 3 to their corresponding SNR values despite indentation challenges.
Ensure your source text or CSV log file is saved locally on your computer, and take note of the exact file path before importing it into your query.
Import and Transform Log Data Using Power Query
The most efficient way to parse structured text logs is by using the built-in data transformation tools in Power Query to split fields and map receiver ports.
Power Query provides robust text manipulation features that can easily handle complex log structures. By sequentially splitting columns and applying conditional logic, you can map the receiver ports to SNR values without needing external scripts.
Open Excel, navigate to the 'Data' tab, click on 'Get Data', and choose 'From Text/CSV' to locate and import your structured log file.
In the Power Query Editor, select the main data column and use the 'Split Column' feature (found in the Home tab) to separate time, cell ID, and carrier index based on your file's specific delimiter or character length.
Go to 'Add Column' > 'Conditional Column' to create a new column that identifies and flags whether the row contains an SSB or TRS reference signal.
Create custom columns or utilize the 'Pivot Column' feature to map receiver ports (0 through 3) to their corresponding SNR values. Use the 'Trim' function if text indentation is causing misalignment.
Click 'Close & Load' to output the clean data into a spreadsheet table. If your original log file changes location, click the gear icon next to the 'Source' step in Applied Steps to update the file path.
Extract Log Data Using a PHP Script
If you prefer handling data outside of Power Query, you can use a custom PHP script to parse the logs line by line and generate a clean CSV file.
Try WPS Office for Fast and Seamless Data Analysis
While complex Power Query steps are specific to Microsoft Excel, WPS Spreadsheet offers powerful, lightweight, and user-friendly data import and text-to-column tools that handle complex CSV and log files effortlessly.
- 1. Download WPS Office: Install WPS Office for free and open the WPS Spreadsheet application.
- 2. Import Your Log File: Go to the Data tab and select 'Import Data' to easily load your CSV or text log files.
- 3. Use Text-to-Columns: Highlight your imported log strings and use the Text-to-Columns feature to instantly separate your SNR values and receiver ports into structured data.

Frequently Asked Questions
How do I fix misaligned SNR values caused by text file indentation in Power Query?
If all four receiver port values have the same indentation but misalign during import, highlight the column, navigate to the Transform tab, and click Format > Trim. This removes leading and trailing spaces before you split the columns, ensuring accurate mapping for your Rx ports.
How can I update the source file path when my log file location changes?
In the Power Query Editor, look at the 'Applied Steps' pane on the right side. Click the gear icon next to the 'Source' step, and browse to select the new file path before refreshing the query. This prevents the query from failing when you move the log files.
Can I parse telecom log files without using Power Query?
Yes. You can use scripting languages like PHP or Python to parse and extract the structured data into a standard CSV file, or you can use the built-in 'Text-to-Columns' feature available in applications like WPS Spreadsheet for straightforward delimiter-based logs.
What are SSB and TRS in telecom log files?
SSB (Synchronization Signal Block) and TRS (Tracking Reference Signal) are specific signal identifiers in 5G networks. In your text logs, filtering and identifying these reference signals allows you to analyze receiver port performance and SNR metrics independently for different signal types.




