Data Import & Export

How to Extract Data from Variable-Length CSV Sections in WPS Office Excel

Camila MilosovichCamila Milosovich Nov 13, 2026 868 views

Question details

The user needs to import generated CSV reports with sections that have a different number of rows and extract dates and values reliably using stable markers rather than fixed row positions.

How to Extract Data from Variable-Length CSV Sections in WPS Office Excel
Product
WPS Office Excel / Power Query
Device & OS
not provided
Scenario
Importing generated CSV reports where each section contains a varying number of rows and extracting specific dates and values from each section.
Observed behavior
The desired state is a reliable import process that identifies each section by stable markers such as the date in column A and three blank rows, then formats dates as MM/DD/YYYY and amounts as numbers with two decimal places without comma separators.
Before you start

Before you start, verify that each CSV section has a consistent marker—such as a date value in column A followed by three blank rows—and open the CSV file in WPS Office Excel so the Power Query import tools are available.

Solution 1Recommended

Import and Extract CSV Sections with Power Query Using Stable Markers

Use this solution when section row counts vary but each section has a consistent marker, because Power Query can locate boundaries dynamically instead of relying on fixed rows.

Power Query reads the entire CSV and lets you create logic based on column values and blank-row patterns. This avoids the common failure of fixed row references when generated reports change from one export to the next.

1
Open the CSV in Power Query

In WPS Office Excel, click Data > From Text/CSV, select the generated CSV file, and then click Import to open the Power Query Editor.

2
Locate section markers

In Power Query Editor, use the date values in column A and the three consecutive blank rows—or another stable marker—to identify where each section begins and ends.

3
Extract values by relative position

Add custom columns that reference the required cells relative to each section marker, such as the rows immediately below the date marker, so extraction stays correct when the row count changes.

4
Format dates and amounts

Select the date column, set Data Type to Date and format it as MM/DD/YYYY; select amount columns, set Data Type to Decimal Number, use two decimal places, and remove thousands or comma separators.

5
Load the transformed table

Click Close & Load to return the cleaned, sectioned data to the worksheet for further analysis.

Import and Extract CSV Sections with Power Query Using Stable Markers
Reliable extraction: Using markers and relative references keeps the query stable even when the generated CSV report changes the number of rows in a section.
WPS Office Excel solution

Import Variable-Length CSV Sections in WPS Office Excel with Power Query

WPS Office Excel can import the CSV into Power Query, locate section boundaries with stable markers, and extract relative date and value fields without depending on fixed row numbers.

  1. 1. Download and install WPS Office: Go to the official WPS website and download WPS Office Free, then install it on your computer.
  2. 2. Open the CSV file: Launch WPS Office Excel and click Data > From Text/CSV to import the generated CSV report.
  3. 3. Apply marker-based transformations: In the Power Query Editor, identify each section by the date in column A and the three blank-row marker, then add custom columns to extract relative values.
  4. 4. Format and load the data: Set date columns to MM/DD/YYYY, format amount columns as numbers with two decimal places and no comma separators, and click Close & Load.
Handles variable-length CSV sections with stable markers such as date cells and blank-row boundaries.Full compatibility with Microsoft Excel .xlsx and .csv formats for seamless import and export.Familiar ribbon interface and Power Query-style workflow for a smooth transition from Excel.Free, lightweight, and easy to use without a subscription.
microsoft office alternative - wps office

Frequently Asked Questions

How do I identify each section in a CSV when the number of rows changes?

Use a consistent marker that exists in every section, such as the date in column A followed by three blank rows. In Power Query Editor you can reference these markers to create conditional logic instead of relying on fixed row numbers.

Can I use fixed row numbers to extract data from a variable-length CSV report?

Only if you are certain the report structure will never change. For variable-length sections, fixed row references shift when rows are added or removed, so marker-based Power Query logic is more reliable.

How do I format extracted dates as MM/DD/YYYY and amounts without comma separators in WPS Office Excel?

In Power Query Editor, select the date column, set Data Type to Date, and choose the MM/DD/YYYY format. For amount columns, set Data Type to Decimal Number, specify two decimal places, and remove thousands or comma separators from the number format.

Where can I open Power Query to import a CSV in WPS Office Excel?

In WPS Office Excel, go to Data > From Text/CSV, select the CSV file, and click Import. The Power Query Editor opens so you can transform sections before loading them into the worksheet.

Why does my CSV import break when the generated report adds or removes rows?

It usually breaks because the process depends on fixed row positions. Switch to a marker-based approach in Power Query using the stable section markers such as the date in column A and the three blank rows so extraction follows the section rather than the row number.