The official Apple guide to replacing the RAM says nothing about disconnecting the battery but it does recommend touching metal inside to discharge static. https://support.apple.com/en-us/HT201165
crwdns2858784:0crwdne2858784:0
crwdns2858785:0crwdne2858785:0
crwdns2858779:0crwdne2858779:0
The official Apple guide to replacing the RAM says nothing about disconnecting the battery but it does recommend touching metal inside to discharge static. https://support.apple.com/en-us/HT201165