Encountered an error and wanted to share my solution as I couldn't find it online.
Initially, my code looked like this:
import * as google from 'googleapis';
const sheetsAPI = google.sheets({
version: 'v4',
auth: apiKey
});
This resulted in the error:
google.sheets is not a function
To resolve this issue, I made use of the following code instead:
const sheetsAPI = new google.sheets_v4.Sheets({
auth: apiKey
});
Running this code worked correctly despite what the available guides suggested for the initial code provided.
I plan on accepting my own answer when possible, but I am curious as to why I encountered this problem if the documentation for such a reputable platform advised using the original code?