SharePoint Document Issues

How to Set a SharePoint Default Value Based on File Extension

Tauseeq MagsiTauseeq Magsi Nov 3, 2026 868 views

Question details

The user needs to automatically set a custom Status column to "Draft" in a SharePoint document library exclusively for uploaded Word and Excel files, while leaving the status blank for other file types.

How to Set a SharePoint Default Value Based on File Extension
Product
SharePoint
Device & OS
not provided
Scenario
Automating metadata tagging in a SharePoint document library to distinguish draft office documents from other uploaded file formats.
Observed behavior
SharePoint's default-value formula does not allow referencing other columns, such as the file name or Title, preventing the automatic assignment of values based on the file extension.
Before you start

Ensure you have the necessary permissions to create and manage Microsoft Power Automate flows for your SharePoint document library.

Solution 1Recommended

Use Power Automate to Set the Status Column Dynamically

Since SharePoint default-value formulas cannot reference the file name, building a Power Automate flow is the most reliable way to detect file extensions and update column values.

Power Automate can extract the file extension immediately after a document is uploaded to the library. By using a condition block, the flow evaluates the extension and updates the item's properties accordingly. This ensures the actual field value is set, making it usable for subsequent workflows.

1
Create a new automated flow

Go to Power Automate, click "Create", and select "Automated cloud flow". Choose the trigger "When a file is created (properties only)" and connect it to your SharePoint site address and document library.

2
Extract the file extension

Add a "Compose" action to your flow. In the Inputs field, write an expression to extract the extension from the filename, such as: last(split(triggerOutputs()?['body/{FilenameWithExtension}'], '.')

3
Set up a condition

Add a "Condition" control. Configure it to check if the outputs of the Compose action is equal to 'docx', 'doc', 'xlsx', or 'xls'. You can add multiple rows using the 'OR' logic rule.

4
Update the file properties

In the "If yes" branch of the condition, add an "Update file properties" action. Select your SharePoint site and library, map the "Id" to the ID from the trigger, and manually set your Status column dropdown to "Draft".

Real-time updates: Once saved and turned on, this flow will automatically process any new files uploaded to the library and update the metadata within seconds.
Free Microsoft Office alternative

Looking for a Lightweight Office Suite for Your Documents?

While SharePoint handles cloud storage and metadata, creating and editing those Word and Excel files requires a robust office suite. WPS Office is a highly compatible, feature-rich alternative to Microsoft Office that easily handles .docx and .xlsx formats.

  1. 1. Download the installer: Visit the official WPS Office website and click the free download button for your operating system.
  2. 2. Install the software: Run the downloaded installation package and follow the brief on-screen instructions to complete the setup.
  3. 3. Open your files: Launch WPS Office and open your existing Word or Excel documents directly to enjoy seamless editing and formatting.
Fully compatible with Microsoft Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) file formats.Lightweight installation that runs smoothly on Windows, Mac, and Linux without consuming excessive system resources.Familiar tabbed user interface, ensuring a zero learning curve for new users.Built-in PDF editing and format conversion tools included for free.
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I use a default value formula based on the file name in SharePoint?

SharePoint's default value settings are evaluated at the column level before the item is fully created, meaning they do not support referencing other columns (including the Title or File Name). Only calculated columns can reference other fields within the same item.

Can SharePoint column formatting update the actual field value?

No, JSON column formatting only changes how the data is displayed visually in the SharePoint list or library view. It does not alter the underlying data value stored in the database, which is necessary if the field will be evaluated by Power Automate flows.

Will a Power Automate flow update the status for existing files in the library?

By default, a flow triggered by "When a file is created" will only process new files uploaded after the flow is activated. To update existing files in the library, you must create a separate manual or scheduled flow to loop through all current items and apply the changes.