Power Query Problems

Combine and Sort Multiple PDF Files in Excel Power Query

Anum MushtaqAnum Mushtaq Nov 18, 2026 870 views

Question details

Combine data from multiple PDF files and sort the resulting records by date and hour.

Combine and Sort Multiple PDF Files in Excel Power Query
Product
Microsoft Excel Power Query
Device & OS
not provided
Scenario
Each PDF contains data for a separate date, and the user wants one date- and time-sorted table.
Observed behavior
The desired result is a combined table with a usable date and time for each record.
Before you start

Place the PDFs in one folder and check that their tables have a consistent layout. Identify whether each date comes from the file name or the PDF content, and check how the hour is represented.

Solution 1Recommended

Combine PDF tables from a folder and sort by date and time

Use Power Query to apply the same extraction steps to similarly structured PDFs and load a sorted table into Excel.

1
Connect to the folder

In Excel, select Data > Get Data > From File > From Folder, choose the PDF folder, and select Transform Data. Filter the Extension column to .pdf if the folder contains other file types.

2
Combine the PDF tables

Select Combine Files on the Content column, or use Combine > Combine & Transform Data. In the sample-file dialog, select the table or page containing the records and confirm. Check the preview to make sure the extracted columns are correct.

3
Create or check the date column

If the date is in the PDF table, keep that column. If it is in the file name, keep the source-name column, select it, and use Add Column > Extract to isolate the date portion. Set the resulting column's data type to Date; use Change Type > Using Locale if the date format needs a specific locale.

4
Set the time type

Select the column containing the hour or time and choose Data Type > Time if it contains time values. If it contains only numeric hours, set it to a numeric type instead.

5
Sort and load the results

With the date and time columns typed, use the Power Query formula bar to add a step such as = Table.Sort(#"Changed Type", {{"Date", Order.Ascending}, {"Hour", Order.Ascending}}). Replace the previous step and column names with those in your query, then select Home > Close & Load.

Combine PDF tables from a folder and sort by date and time
Check the source layout: The sample-file transformation is applied to the other PDFs. Files with different table layouts, image-only pages, or inconsistent file names may need separate preparation or extraction.
Free Microsoft Office alternative

Work with Extracted PDF Data in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format support for moving existing files. After extracting PDF data into a spreadsheet, you can review and sort it in WPS Spreadsheets; it does not fix Excel Power Query or replace the folder-combine workflow described above.

Review and sort extracted date and time columns in WPS SpreadsheetsOpen and save Microsoft Excel formats, including XLSXUse a familiar interface when moving from Microsoft OfficeWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Do I need to export each PDF separately before combining it?

Not necessarily. In Excel, Data > Get Data > From File > From Folder can combine similarly structured PDF files using a sample-file transformation.

How can I use a date from each PDF file name?

Keep the source-name column after combining the files, then use Add Column > Extract to isolate the date text. Change the new column to the Date type, using a locale if necessary.

Why are my dates or hours sorting in the wrong order?

They may be stored as text. In Power Query, select the date column and set its data type to Date; set time values to Time or numeric hours to a numeric type before sorting.

What if the PDFs have different table layouts?

The sample-file transformation may not extract every file correctly. Check the combined preview and, if necessary, group files by layout and create a separate query for each group before combining the results.