How to add AJAX in a custom PHP function using Google sheets API

How to add AJAX in a custom PHP function using Google sheets API