Changes for page 2 Script
Last modified by Devin Chen on 2026/03/10 10:53
From version 12.4
edited by Devin Chen
on 2026/03/05 14:29
on 2026/03/05 14:29
Change comment:
There is no comment for this version
To version 18.1
edited by Devin Chen
on 2026/03/05 15:57
on 2026/03/05 15:57
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Attachments (0 modified, 7 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1931,23 +1931,23 @@ 1931 1931 1.1 Create a table file based on actual needs and fill in the headers. 1932 1932 1933 1933 (% style="text-align:center" %) 1934 -[[image:WeCom Screenshot_20260305114836.png]] 1934 +[[image:WeCom Screenshot_20260305114836.png||height="618" width="977"]] 1935 1935 1936 1936 1.2 Modify the access permissions of the table to 'Anyone on the internet with the link can edit'. 1937 1937 1938 1938 (% style="text-align:center" %) 1939 -[[image:z6rgXmeOMz1.png]] 1939 +[[image:z6rgXmeOMz1.png||height="621" width="982"]] 1940 1940 1941 1941 1.3 Enable the Apps Script extension feature for the sheet. 1942 1942 1943 1943 (% style="text-align:center" %) 1944 -[[image:u8QbgKcOgA.png]] 1944 +[[image:u8QbgKcOgA.png||height="621" width="982"]] 1945 1945 1946 1946 1.4 On the Apps Script editing page, program according to actual needs. 1947 1947 1948 1948 Google Apps Script Demo 1949 1949 1950 -{{code language=" none"}}1950 +{{code language="JavaScript"}} 1951 1951 /** 1952 1952 * Handles POST requests: parses JSON data, writes it to the sheet with timestamp 1953 1953 * Expected JSON format: { ... ... @@ -2000,11 +2000,56 @@ 2000 2000 // 7. Return success response 2001 2001 return ContentService.createTextOutput('Success: Data written to Google Sheets'); 2002 2002 } 2003 - 2004 -/** 2005 - * Handles GET requests (optional, for testing) 2006 - */ 2007 -function doGet(e) { 2008 - return ContentService.createTextOutput('This endpoint accepts POST requests only. Please use POST with JSON data.'); 2009 -} 2010 2010 {{/code}} 2004 + 2005 +(% style="text-align:center" %) 2006 +[[image:PixPin_2026-03-05_14-40-27.png||height="623" width="985"]] 2007 + 2008 +1.5 Click "Deploy" to make a new deployment. Select the 'Web APP' type, set the user permissions, and complete the deployment of the script. 2009 + 2010 +(% style="text-align:center" %) 2011 +[[image:3W00uSwkVQ1.png||height="641" width="981"]] 2012 + 2013 +1.6 In the 'Manage deployments' interface, obtain the URL of the web app. 2014 + 2015 +(% style="text-align:center" %) 2016 +[[image:HoLYu2nzvq.png||height="631" width="966"]] 2017 + 2018 +2. Test the Web APP URL 2019 + 2020 +With the Web APP URL, we can test it via API testing tool (Postman, Hoppscotch) 2021 + 2022 +Web APP Handles POST requests: parses JSON data, writes it to the sheet with timestamp 2023 + 2024 +Header: [Content-Type: application/json] 2025 + 2026 +Expected JSON format: { 2027 + 2028 + sheetName: "Sheet1" (optional, defaults to "Sheet1"), 2029 + 2030 + integerNumber: 123, 2031 + 2032 + floatingNumber: 45.67, 2033 + 2034 + stringData: "example text" 2035 + 2036 + } 2037 + 2038 +(% style="text-align:center" %) 2039 +[[image:8a8vG9Z7IT.png||height="597" width="913"]] 2040 + 2041 +POST request execution effect 2042 + 2043 +(% style="text-align:center" %) 2044 +[[image:WeCom Screenshot_20260305153954.png||height="602" width="921"]] 2045 + 2046 +{{info}} 2047 +After successfully testing with the API tool, it is recommended to change the General access of the Google Sheet to 'Restricted.' This will help improve data security without affecting the use of the Web App. 2048 + 2049 +(% style="text-align:center" %) 2050 +[[image:RW7OUCVVp1.png||height="617" width="943"]] 2051 + 2052 + 2053 +{{/info}} 2054 + 2055 +
- 3W00uSwkVQ1.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.DevinChen - Size
-
... ... @@ -1,0 +1,1 @@ 1 +140.1 KB - Content
- 8a8vG9Z7IT.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.DevinChen - Size
-
... ... @@ -1,0 +1,1 @@ 1 +132.2 KB - Content
- Doa6Qhp4bS.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.DevinChen - Size
-
... ... @@ -1,0 +1,1 @@ 1 +139.2 KB - Content
- HoLYu2nzvq.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.DevinChen - Size
-
... ... @@ -1,0 +1,1 @@ 1 +136.6 KB - Content
- PixPin_2026-03-05_14-40-27.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.DevinChen - Size
-
... ... @@ -1,0 +1,1 @@ 1 +154.8 KB - Content
- RW7OUCVVp1.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.DevinChen - Size
-
... ... @@ -1,0 +1,1 @@ 1 +100.0 KB - Content
- WeCom Screenshot_20260305153954.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.DevinChen - Size
-
... ... @@ -1,0 +1,1 @@ 1 +71.7 KB - Content