Barcode scanner App unable post data to the google sheet

I try to create an simple barcode scanner app to maintain the hardware inventory system, how ever, averythings seen okay but program not able to send data to my linked google sheet, i not sure what happen, the google sheet is share to everyone and also the app script to deploy to anymore. I not sure what else I can change for solve this issue to post data to the google sheet.

block:

google app sheet:


function doGet(e){

  post_value(e);

  

}

//Recieve parameter and pass it to function to handle

function post_value(request){

  //Edit this link to your google sheets

  const ss=SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1mpOBqUTjP44Upb4ebstTXzRLrsE0VD05-o4T_iNEPFc/edit#gid=0");

  const sheet = ss.getSheetByName("barcode");

  

  const d = new Date();

  const currentTimeArray = d.toLocaleString().split(", ");

  const date = currentTimeArray[0]

  const time = currentTimeArray[1]

  

  const barcode = request.parameter.barcode;

  const country = request.parameter.country;

  

  sheet.appendRow([date,time,barcode,country]);  

  

  result = JSON.stringify({

    "result": "OK"

  });  

    

  return ContentService

  .createTextOutput("(" + result + ")")

  .setMimeType(ContentService.MimeType.JAVASCRIPT);   

}

created google sheet:

Assuming everything else is OK, you need a question mark here:

image

?barcode=

3 Likes

This is how web input data works, that's why.

The first parameter requires a ?, subsequent parameters require a & when making a GET request.

If you use POST with the PostText block, then you can omit the ?

1 Like

Thank you very much, the problem solved now :smiling_face_with_three_hearts:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.