I cannot find any simple answer for this.

I have a SharePoint list. I need to have a column that will show row number that starts from 1 and then auto increments for the next rows 2,3,4,5 etc. and for example if you delete row number 25 the row 26 will change to 25 etc.

How can I achieve this ?

The default ID column does not Update when row is deleted, so currently my list starts from 7,653. Is there a way to make ID column work normally?

  • Very good answers, the problem is that the result does not generate a number that can be used, it is only graphic, in my case I would need it to generate a number that can be used.
    – user109143
    Jul 31, 2023 at 13:07

2 Answers 2


I agree with user79408, you can achieve your needs through Column JSON Formatting.

Please follow the steps:

1.Create a Single line of text column. In my test, this column named [DocId]

enter image description here

2.Column settings >> Format this column

enter image description here

3.On the Format Column windows, select "Advanced mode" link

enter image description here

4.Paste the below JSON formatting

Note:@rowIndex starts from 0 by default and sets the increment to 1.

enter image description here

5.Here is my test:

enter image description here


If you only need it for display purposes, you could use column formatting to meet your needs.

If you're unfamiliar with column formatting, have a read of the documentation here

The key to your requirements is to leverage the @rowIndex and add 1, as the index starts at 0.

Something like this should work. The important part is in the txtContent section of the code below, the rest is just styling. You could either apply this formatting to an existing column or create a new column, depending on your preferences and requirements.

  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
      "elmType": "span",
      "style": {
        "overflow": "hidden",
        "text-overflow": "ellipsis",
        "padding": "0 3px"
      "txtContent": {
        "operator": "+",
        "operands": [

Not the answer you're looking for? Browse other questions tagged or ask your own question.