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

google-sheet-s3

Google Apps Script that publishes a Google Sheet to Amazon S3 as a JSON file. Auto-updates on edit & maintains data types. Creates an array of objects keyed by column header.

AI Summary

google-sheet-s3

Publishes Google Sheets to S3 as typed JSON files.

Target Users

Beginner GAS developers needing fast public spreadsheet data on websites sans DB/API.

Problems Solved

Can't serve fast public JSON from sheets without DB, API, or OAuth requirements.

Script ID

  1. In GAS Editor: Click "Libraries +" → Paste into "Script ID" field → Click "Look up"
  2. "google-sheet-s3" will appear in the search results
  3. Select the latest version (highest number) from "Version" dropdown
  4. Click "Add"

Tags

Main Features
1
No OAuth

Public access without OAuth unlike Sheets API. Ideal for anonymous viewers.

2
Fast Responses

S3 delivers data 10-20x faster than GAS Web Apps for high traffic sites.

3
No Extra Cost

No fees like Airtable. Easy multi-user updates via shared spreadsheet.

Examples

Main Functions

FunctionDescription
Publish to S3Publish sheet as JSON to S3

Examples

Using Publish to S3 Add-on
/**
 * S3公開アドオン使用
 * ・S3バケットポリシー設定: "s3:GetObject" を許可 (bucket policy JSON)
 * ・CORS設定追加: <AllowedOrigin>*</AllowedOrigin> でGET許可
 * ・アドオンメニュー実行: Add-ons > Publish to S3 > Publish
 */
function usePublishToS3() {
  // 1. AWS S3バケットとIAMユーザー準備
  // 2. Google Sheetで Add-ons > Publish to S3 > Configure... で認証情報入力
  // 3. Add-ons > Publish to S3 > Publish でJSONをS3へアップロード
}

Verify Data Format
/**
 * データ形式確認
 * ・列ヘッダーキー化: 1行目をオブジェクトキーとして配列生成
 * ・データ型維持: numbers, booleansを保持 (例: "post_time": "2022-12-28T23:44:55.000Z")
 * ・空行/空列無視: 空行スキップ、ヘッダー無し列除外、空白セルはnull
 */
function verifyOutputFormat() {
  // 生成JSON例:
  // [
  //   {"headline": "Lorem...", "publish": true}
  // ]
  // S3 URLから直接Ajaxフェッチ可能
}

Sample Code

Post a Sample

No sample codes for this library yet

Be the first to post a sample!

Post a Sample