I have not seen a way to do this with google sheets. A quick google search shown one way be using the in-sheet function =ROW() which returns the row number the record. Perhaps this would work for you. Though this may cause issues when removing data and changing references.
Another thought I had is using a UUID value instead of an auto-increment value for your id/key. There is a UUID module which I haven't verified if it is available in Retool. There is also an emerging standard of crypto.randomUUID which could work as well.
Though longer than id's it does provide more accurate uniqueness in your table structure.