Resolved: Add increment column in VisiData

In this post, we will see how to resolve Add increment column in VisiData


In VisiData 1.5.2, how can I add a new column which contains the row number?
This can be done in version 2.0 by pressing i I think, but that does not work in 1.5.2. When I try that it says:
no command for "i"
Maybe there’s a way of referencing the current row number in a expression?

Best Answer:

This is more complicated than i, but it will work!
Use za to create a new column. Then move your cursor to that column, and press gs, then gz=. Type in range(n) where n is the number of rows in your sheet (you can reference the number in the buttom right corner).
Another option is that you can try putting the code for i ( in your installation of VisiData, and see if it ‘just’ works. VisiData’s code was intentionally made very modular to allow for easier plug and play possibilities. Just make sure to add it to your imports in the __init__ file as well:

If you have better answer, please add a comment about this, thank you!