Google SpreadSheet 當資料庫

之前一直有想說,能不能自己設計問卷網頁,然後將資料存在 google 的試算表裡面,但一直不知道該怎麼做。今天湊巧在 (1) 線上 nodejs 讀書會 看到相關連結。太幸運了 ~

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

輸入

<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>

查詢

<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>

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

Last updated