How to Create Sequential Custom IDs in a SharePoint Document Library
Question details
The user needs a way to automatically generate and assign custom formatted sequential IDs (e.g., Doc0001) when new documents are added to a SharePoint library.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Organizing, tracking, and standardizing file identifiers within a SharePoint Document Library for better document management.
- Observed behavior
- SharePoint assigns a standard built-in numeric ID to items, but it does not natively support formatting this ID with prefixes or leading zeros as a custom identifier.
Ensure you have permission to edit the target SharePoint Document Library settings to add columns, and that you have access to create workflows in Microsoft Power Automate.
Use Power Automate to Generate Custom Sequential IDs
Create an automated workflow that triggers upon file creation to format the built-in ID into a custom string and save it to a new column.
SharePoint automatically assigns a unique numeric ID to every item upon creation. While it lacks built-in formatting options, you can use Power Automate to concatenate a text prefix with a zero-padded string of this ID, thereby generating a standardized custom identifier.
Navigate to your SharePoint Document Library, click 'Add column', choose 'Single line of text', and name it 'Custom ID'.
Click 'Integrate' from the library menu, select 'Power Automate', then 'Create a flow'. Choose the 'When a file is added or modified' trigger to start building your automated process.
Add a new 'Compose' action step. Use an expression to format the built-in SharePoint ID with leading zeros and your desired prefix. For example: concat('Doc', formatNumber(triggerOutputs()?['body/ID'], '0000')).
Add an 'Update file properties' action. Select your SharePoint site URL and Library Name, map the Item ID, and set your newly created 'Custom ID' column value to the dynamic outputs from the previous Compose step.
Save your flow and ensure it is turned on. Upload a test document to your SharePoint library and wait a few moments to verify that the Custom ID column populates correctly.

Looking for a Lightweight Office Suite for Your Documents?
While SharePoint and Power Automate are excellent for enterprise workflows, viewing and editing the actual documents requires a reliable office suite. WPS Office is a free, lightweight, and highly compatible alternative to Microsoft Office that lets you work seamlessly with Word, Excel, and PowerPoint formats.
- 1. Download WPS Office: Visit the official WPS website and download the free installer tailored for your operating system.
- 2. Install and Launch: Run the installation file and open WPS Office once the setup is complete.
- 3. Edit Your Documents: Open documents downloaded from your SharePoint library directly in WPS Office to edit them with full formatting compatibility.

Frequently Asked Questions
Can I create custom SharePoint IDs without using Power Automate?
SharePoint does not offer a native out-of-the-box feature to format built-in IDs with custom prefixes or leading zeros automatically. Using Power Automate or deploying a custom SharePoint Framework (SPFx) extension is required.
Will the custom ID apply to existing documents already in the library?
The standard 'When a file is created' trigger in Power Automate only processes new files. To retroactively update existing files, you must create a manual or scheduled flow to loop through current items and apply the formatting logic.
Why is the Custom ID column blank immediately after I upload a document?
Because Power Automate runs in the background, it typically takes a few seconds up to a minute for the flow to detect the new file, generate the custom ID, and write it back to the library. Refreshing the page shortly after upload will reveal the updated value.
What happens to the ID sequence if a document is deleted?
SharePoint's underlying built-in ID always increments and does not reuse numbers from deleted items. Since your custom ID is based on this built-in ID, deleting a document will result in sequential gaps (e.g., Doc0001, Doc0003).




