Skip to content

Instantly share code, notes, and snippets.

@Mulannnnn
Last active December 12, 2023 04:48
Show Gist options
  • Save Mulannnnn/23d0c88c3b1107483abc4d007c2d87b8 to your computer and use it in GitHub Desktop.
Save Mulannnnn/23d0c88c3b1107483abc4d007c2d87b8 to your computer and use it in GitHub Desktop.
Save parameter to google sheet
function doGet(request) {
var ss = SpreadsheetApp.openByUrl("*****");
var name = request.parameter.name;
var nickname = request.parameter.nickname;
var p_image_url = request.parameter.p_image_url;
var sheet = ss.getSheetByName('*****');
var today = new Date();
var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date + ' ' + time;
sheet.appendRow([dateTime, name, nickname, p_image_url]);
// เพิ่มโค้ดเพื่อดึงค่าจากแผ่นงาน
var values = sheet.getRange(1, 1, sheet.getLastRow(), sheet.getLastColumn()).getValues();
var result = {};
result.result = 'ส่งข้อมูลเรียบร้อยแล้วครับ ขอบคุณครับ';
//เปลี่ยนข้อความแสดงสถานะสำเร็จได้ตามใจชอบ
//console.log(result)
var result = JSON.stringify(result);
return ContentService.createTextOutput(result).setMimeType(ContentService.MimeType.JSON);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment