メインコンテンツにスキップ

Gsheet_Godot

Connecting Google Sheet into godot with READ and WRITE access

AI Summary

Gsheet_Godot

Provides Google Apps Script REST endpoints that allow Godot projects to read from and write to Google Sheets.

Target Users

Godot game developers with little GAS experience who need a server-less way to persist and share game data.

Problems Solved

Connecting a Godot game to a cloud datastore for CRUD operations usually requires building and hosting a custom API.

Tags

Main Features

1
Bundled Spreadsheet CRUD

Pre-built functions such as fetch_notes_list and create_new_note expose list, create, update and delete operations out of the box.

2
Simple HTTP GET/POST Interface

Godot only needs an HTTPRequest node to hit the URL; data exchange is pure JSON over GET/POST.

3
Serverless & Zero Hosting Cost

The backend runs as a deployed Web App on Google Apps Script, eliminating the need for custom servers or database hosting.

Usage Examples

GET endpoint that returns a list of notes

/**
 * GET endpoint called from Godot, e.g.
 * https://script.google.com/macros/s/XXXXXXXX/exec?action=fetch_notes_list
 */
function doGet(e) {
  if (e.parameter.action === 'fetch_notes_list') {
    return fetchNotesList();
  }
  return ContentService.createTextOutput('Invalid action');
}

/**
 * Reads two columns (ID & Title) from the sheet and returns a JSON array.
 */
function fetchNotesList() {
  const sheet = SpreadsheetApp.openById('<<YOUR_SHEET_ID>>').getSheetByName('data');
  const values = sheet.getRange(2, 1, sheet.getLastRow() - 1, 2).getValues();
  const notes = values.map(row => ({ id: row[0], title: row[1] }));
  return ContentService
    .createTextOutput(JSON.stringify(notes))
    .setMimeType(ContentService.MimeType.JSON);
}

Deploy this script as a Web App, then call ...?action=fetch_notes_list from Godot to receive a JSON array of notes.