# Google SpreadSheet 當資料庫

之前一直有想說，能不能自己設計問卷網頁，然後將資料存在 google 的試算表裡面，但一直不知道該怎麼做。今天湊巧在 [(1) 線上 nodejs 讀書會](https://www.facebook.com/groups/207139586323090/permalink/359272637776450/) 看到相關連結。太幸運了 \~

中間還有提到 spreadsheet轉json，用google語音念google文件。幹，好像更厲害，竟然是即時逐字稿!

輸入

* [Jim: 以 Google 試算表作為簡易資料庫 (上)-- 資料庫的建立及寫入](http://blog.jim60105.com/2015/06/google-database.html)

```javascript
<html>
<body>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

    NO: <input type="text" id="numberInput"><br><br>
    Name: <input type="text" id="nameInput"><br><br>
    Score: <input type="text" id="scoreInput"><br><br><br>

    <input type="button" value="送出" onclick="SendScore()">
    <script type="text/javascript">
        function SendScore(){
            $.get("https://script.google.com/macros/s/AKfycbwZvCG09-SiFnA7QRBjNe2jNuIVAqikeh8dEGv136cfytQQSWY/exec", {
                        "number": document.getElementById("numberInput").value,
                        "name": document.getElementById("nameInput").value,
                        "score": document.getElementById("scoreInput").value
                    },
                    function (data) {
                        document.write("--------------------------");
                        document.write("Result = "+data);
                        document.write("--------------------------");
                    });
        }
    </script>
</body>
</html>
```

查詢

* [Jim: 以 Google 試算表作為簡易資料庫 (下)-- 資料庫的讀取](http://blog.jim60105.com/2015/06/google-database2.html)

```javascript
<html>
<body>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

    NO: <input type="text" id="numberInput"><br><br>
    Name: <input type="text" id="nameInput"><br><br>
    Score: <input type="text" id="scoreInput"><br><br><br>

    <input type="button" value="送出" onclick="SendScore()">
    <script type="text/javascript">
        function SendScore(){
            $.get("https://script.google.com/macros/s/AKfycbyhBAwhs1pMXZ-wCD-lxsF_oPILjKCOQ8aynkOKrAgeMySUXFA/exec", {
                        "number": document.getElementById("numberInput").value,
                        "name": document.getElementById("nameInput").value,
                        "score": document.getElementById("scoreInput").value
                    },
                    function (data) {
                        document.write("--------------------------");
                        document.write("Result = "+data);
                        document.write("--------------------------");
                    });
        }
    </script>
</body>
</html>
```

我用來存放測試檔案的資料夾

* <https://drive.google.com/drive/folders/0B1xFGvwsMd3hcWRjSzJnV1pvTG8?usp=sharing>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ayugioh2003.gitbook.io/front2end/front/googlespreadsheet-dang-zi-liao-ku.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
