Script to share a Google Spreadsheet within sheet

Hi!

Thank you very much for your fabulous website! I’d need to assign different Google spreadsheets with different people. I’d know if is it possible to do this with Google scripts, something like:
=setFileSharing(“ID to be shared”; “googleaccountdestination@gmail.com”)

Thank you!