Back to blog
6 min read Export Guides

How to Export WordPress Media Library Files to CSV or Excel

The Media Library shows thumbnails, not a list you can sort by file size or missing alt text. In Import Export by RockStarLab → Export, choose Media, pick the attachment fields and download the file, one Media Library entry per row. For an image audit, start with the ID, file URL, alt text, width, height and size in bytes, and add the caption if an editor will review how images are described.

Choose what belongs in the spreadsheet

Task Columns to keep How to use them
Find large images File URL, MIME Type, File Size (bytes), Width, Height Sort size from largest to smallest. Compare pixel dimensions with the space the image occupies on the page.
Review image descriptions ID, Title, File URL, Alt Text, Caption Filter to images and review empty alt text in the context where each image appears. A decorative image can intentionally have empty alt text.
Prepare a transfer File URL, Title, Alt Text, Caption, Description Keep source URLs reachable while the destination downloads the files.

1. Select Media in the export wizard

Activate Import Export by RockStarLab, open its Export screen and select the Media card. Click Next Step. This reads attachments registered with WordPress. If files arrived by SFTP and are missing from Media → Library, first register the uploaded files in the Media Library.

Media selected in the WordPress export wizard
Choose Media to work with attachment records.

2. Set the scope

For the whole library, leave the filters empty and note Total items available. If you only need part of the library, click Add Filter, select a field and condition, enter your value and check the resulting count. For a recurring report, keep a note of the condition so the next export covers the same population. See the export filter examples for more combinations. If you already know the exact files you want, follow the guide to exporting selected attachments.

Media export filters and total available attachments
Leave the filters empty to include the full library.

3. Select and order the fields

Drag fields from Available Fields to Export File Structure. Use Add all beside a group to include that group, or the top-level Add all button for the full set. Arrange the columns in reading order. Put ID first when you plan to compare two exports. Titles can repeat, while each attachment on the same site has its own ID.

Attachment fields arranged as export columns
The left column sets the order of the spreadsheet headers.

Choose File URL (file_url) for a link to the file. File Path (Relative) identifies its location relative to uploads. File URL (GUID) is a separate stored value and can still reference an earlier domain after a site move. Open a few file URLs before handing a migration sheet to another team.

Attached To (Post ID) identifies the attachment’s parent. An image can appear in a page, a template or a custom field even when the parent is empty. Review where a file is used before making a cleanup decision. For images stored inside ACF content, see exporting ACF fields and image references.

4. Download a CSV or Excel workbook

Click Next Step and select CSV for a delimited text file or XLSX for an Excel workbook. For CSV, leave the comma delimiter unless your receiving tool expects another separator. Keep Include Header Row enabled. Enter the file name without its extension. The optional {job_id} placeholder helps distinguish successive downloads.

CSV delimiter, header row and file name options
Include the header row so the first line identifies each field.

Click Start Export, wait for completion and download the export file. Open it in your spreadsheet application and compare the number of data rows, excluding the header, with the scope from step 2. If Excel displays the CSV in one column, import it as delimited text with the same separator you selected. For a native workbook, choose XLSX in the wizard.

Completed Media export jobs in the WordPress Jobs Log
Check the number processed against the scope you selected.

Read the attachment report

Filter post_mime_type to image types before reviewing width, height or alt_text. A PDF and an image have different metadata. Sort file_size numerically to bring large files to the top. To display MiB in a separate spreadsheet column, divide the byte count by 1,048,576. Open an example in Media → Library and compare its URL, dimensions, caption and alternative text with the matching row.

The standard inventory contains URLs and metadata. To copy the actual files, use the spreadsheet as input to import media from file URLs on the destination site. For repeat transfers, review media duplicate handling before starting again.

Export the Media Library with an AI agent

Connect your agent using the WordPress Abilities API setup guide. Ask it to inspect rsl-ie/get-content-schema for media, then give it the scope, format and columns. These prompts serve different tasks.

Create an Excel inventory

Export my entire WordPress Media Library to XLSX with a header row. Include ID, title, file URL, MIME type, file size in bytes, width, height, alt text and caption, in that order. Name it media-inventory-{job_id}. Wait for completion and give me the download link and the number of attachments exported.

The agent can start the export with rsl-ie/export-start, check its status with rsl-ie/job-get and retrieve the download link with rsl-ie/file-get. For XLSX, request spreadsheet_include_header: true. You can open the same job in the WordPress Jobs Log.

Prepare an image audit before downloading

Inspect the media export schema and preview up to five JPEG attachments with their ID, file URL, size, dimensions and alt text. Show me the columns before creating the CSV. After I approve them, export the matching JPEGs with a header row.

When reviewing the sheet, keep the attachment ID with each editorial note so someone can find the right image later. To reproduce the same inventory periodically, follow the guide to scheduling repeated exports.

Video walkthrough

This video shows an earlier version of the export wizard. Use the screenshots above for the current controls.

FAQ

Can I export the WordPress Media Library to CSV?

Yes. Import Export by RockStarLab lets you export WordPress Media Library files to CSV, including file URLs and attachment metadata.

Can I export WordPress media files to Excel?

Yes. You can export media file data to XLSX format for Microsoft Excel workflows.

Can I filter media files before export?

Yes. You can add filters to export only specific media files, such as images wider than a certain number of pixels or files uploaded during a specific date range.

Which media fields can I export?

You can export fields such as attachment ID, title, file URL, file type, MIME type, file size, width, height, alt text, caption, description, and upload date.

Can I use the exported media file for migration?

Yes. The exported media file can be used later to import media files into another WordPress website.

Dmitriy
About author

Dmitriy

WordPress Developer with 15+ years of commercial experience. Elite Author on ThemeForest and creator of custom WordPress plugins. Passionate about clean code, performance optimization, and building useful tools for the WordPress community.

JOIN THE CONVERSATION

Comments 0

Have a question or a tip to share? Leave it below.

Leave a comment

Your email address will not be published. Required fields are marked *

We store your name, email and comment to show and moderate it; your email is never published. Spam protection is provided by Cloudflare Turnstile and profile pictures by Gravatar. See our Privacy Policy.


Try the plugin with no risks!

New users get 1 month with access to all premium features. Experience the most powerful WordPress data engine today.

Download Now
Get PRO for FREE