How to Set a SharePoint Default Value Based on File Extension
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.

- 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.
Ensure you have the necessary permissions to create and manage Microsoft Power Automate flows for your SharePoint document library.
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.
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.
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}'], '.')
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.
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".
Use a Calculated Column for Display Purposes
If you only need users to see the "Draft" status visually and do not require the field for other Power Automate triggers, you can use a calculated column.
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. Download the installer: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install the software: Run the downloaded installation package and follow the brief on-screen instructions to complete the setup.
- 3. Open your files: Launch WPS Office and open your existing Word or Excel documents directly to enjoy seamless editing and formatting.

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.




