Attempting to retrieve rows from a Google Spreadsheet using googleapis for a Vue project. I have set up the necessary project and service account credentials in the Google console. However, upon clicking the button, I encounter this error:
TypeError: The "original" argument must be of type Function
. Below is the code snippet I am using:
<template>
<div id="app" class="container">
<button class="button" @click="getData">Get data</button>
</div>
</template>
<script>
export default {
name: 'app',
methods: {
getData: async function() {
const { google } = require('googleapis');
const range = 'Data!A2:C999';
}
}
}
</script>
The error seems to stem from the line
const { google } = require('googleapis');
, but I'm unable to pinpoint the issue.