How to Fix error in Google_Client and Google_Service_Sheets in PHP Sheets API

After running this composer require google/apiclient:^2.0 in order to use the PHP Google Sheets API. Some of you may encounter this problem, such as getting error when typing Google_Client or using Google_Service_Sheets.

To fix Google_Client error you only need to restart your Visual Studio Code.

However, the error in the Google_Service_Sheets are still there and to solve that, you just need to change that into Sheets.

After that it will automatically generate use Google\Service\Sheets; on top of the PHP file. Then the error will gone.

Leave a Comment

Your email address will not be published. Required fields are marked *