There are two ways you can do this
Use the JavaScript API for Spreadsheets ( https://developers.google.com/api-client-library/javascript/start/start-js )
Write a Google Apps Script, deploy it as a web app and make AJAX/REST calls from your JavaScript. See Content Service to see how this can be done using GAS ( https://developers.google.com/apps-script/guides/content )