Cannot parse text argument

1. Drag in a label at the top of your screen

2.Set the label text to responseContent in your blocks, just above where you set it to the global stock_list
image

3.What do you see in the label?

Can you translate that last part of the error message before </body> ?

The responseContent you received is obviously not a csv table, maybe you have problems in your script.

Show your script for action edit_stock and what you are sending in the posttext.

function doPost(e) { 
  var ss = SpreadsheetApp.openByUrl(e.parameter.File);
  var sheet = ss.getSheetByName(e.parameter.Sheet);

  ActionsFichier(e,sheet);

}

  
function ActionsFichier(e,sheet) {
  
  //lock sheet to prevent concurrent changes  
  var lock = LockService.getPublicLock();
  lock.waitLock(5000);  
  
  
  // ADD TO TRUCK_SSHEET
  if (e.parameter.Action=="Add_Truck") {
    var item = e.parameter.Item ;
    var box = e.parameter.Box ;
    
    sheet.appendRow([item,box]);
    
   return ContentService.createTextOutput("Success");
  
}

  //EDIT TO STOCK_SSHEET
     if (e.parameter.Action == "Edit_Stock") { 
     var data = [ [ e.parameter.Item, e.parameter.Box]]; 
     sheet.getRange("A"+(parseInt(e.parameter.id)+1)+":B"+(parseInt(e.parameter.id)+1)).setValues(data); 
     return ContentService.createTextOutput("Success");
   }
    
  lock.releaseLock();
}

Sorry still I'm seeing error ;((((

Is a string, not a csv table....

what should I do?

Either change the value you want to return in the script, or stop trying to set a string to a list in the blocks.

Also, I am not sure this is correct:

 var data = [ [ e.parameter.Item, e.parameter.Box]]; 

try

 var data = [e.parameter.Item, e.parameter.Box]; 

tried if I use this, it's not editing

var data = [e.parameter.Item, e.parameter.Box];

If I use this then it's editing:
var data = [ [ e.parameter.Item, e.parameter.Box]];

I will have a look at this later.....

I ran a little test, there seemed to be an issue with openByUrl so I changed this to openById, this worked

function doPost(e) { 
  var ss = SpreadsheetApp.openById(e.parameter.File);
  var sheet = ss.getSheetByName(e.parameter.Sheet);
  if (e.parameter.Action == "Edit_Stock") { 
     var data = [[e.parameter.Item, e.parameter.Box]]; 
     sheet.getRange("A"+(parseInt(e.parameter.id)+1)+":B"+(parseInt(e.parameter.id)+1)).setValues(data); 
   return ContentService.createTextOutput(data);
   }
}

2 Likes

I did in this way:
image
As I understand on Got.Text for each glabal fetch= you can only use one call procedure not more
then it's working