ID
Getting Started

Installation

Install nuxt-gsheet package, register the module, and configure environment variables.

Get started with nuxt-gsheet by installing the package, registering the module in your Nuxt configuration, and setting up environment variables.

Package Installation

Add nuxt-gsheet to your project using your preferred package manager:

npx nuxt module add gsheet

Registering the Module

Add nuxt-gsheet to the modules array in your nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    'nuxt-gsheet'
  ],

  gsheet: {
    // Module default options (optional)
    cache: {
      enabled: true,
      maxAge: 300 // 5 minutes cache TTL
    }
  }
})

Environment Configuration

Configure your Google Sheets credentials or spreadsheet settings in your .env file at the root of your project. nuxt-gsheet automatically detects the authentication mode based on the environment variables defined below.

Option 1: Google Apps Script Mode (appscript)

Use Google Apps Script to proxy requests without creating Google Cloud Platform (GCP) credentials. Supports both Read and Write operations.

.env
GSHEET_APPSCRIPT_URL=https://script.google.com/macros/s/AKfycb.../exec

Option 2: Public Spreadsheet Modes (gviz or csv)

Use GViz or direct CSV export for zero-config, read-only access to public spreadsheets. No API keys or GCP credentials required.

.env
GSHEET_SPREADSHEET_ID=your-google-spreadsheet-id

Option 3: API Key Mode (apikey)

Use standard Google Sheets API v4 for public spreadsheets with custom quota control.

.env
GSHEET_SPREADSHEET_ID=your-google-spreadsheet-id
GSHEET_API_KEY=AIzaSy...

Option 4: Service Account Mode (service-account)

Use GCP Service Account credentials for private Google Sheets. Supports Read and Write operations.

.env
GSHEET_SPREADSHEET_ID=your-google-spreadsheet-id
GSHEET_CLIENT_EMAIL=your-service-account@your-project.iam.gserviceaccount.com
GSHEET_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY_HERE\n-----END PRIVATE KEY-----\n"

Always keep your .env file in .gitignore. Never commit private keys or API credentials to version control.

Verifying Your Setup

To verify that nuxt-gsheet is set up correctly:

  1. Start your local Nuxt development server:
bun run dev
  1. Open your browser and launch Nuxt DevTools (Shift + Alt + D or click the Nuxt icon at the bottom of the screen).
  2. Look for the Google Sheets tab in the DevTools menu. If visible, the module has loaded successfully.