I found this useful article.
https://github.com/gsuitedevs/apps-script-samples/blob/master/sheets/api/spreadsheet_snippets.gs
But currently I just copy and paste these function. Is there any way to use these snippets like saving somewhere and calling it?
No, there's no way. If you want to access one of your Spreadsheets from a code running on VScode, then use the Sheets API with the programming language of your preference. Here I leave you some quickstart from different languajes: