I can't select data by func==ReadRecord (Google Sheet)

Error :
Select list item: Attempt to get item number 4 of a list of length 3: (errorbody {background-color: #fff; margin: 0; padding: 0;}.errorMessage {font-family: Arial sans-serif; font-size: 12pt; font-weight: bold; line-height: 150%; padding-top: 25px;}

Google Apps Script
TypeError: Cannot read properties of undefined (reading ‘join’) (47th line file name “id”)
)


script :

blocks :




(web got text blocks in one pic)

data :

thank you

Try to run the web url in a browser and check up

var ss = SpreadsheetApp.getActive();
var sh = ss.getSheets()[parseInt(e.parameter.SN)-1];
var rg = sh.getDataRange().getValues();
var outString = '';
outString += rg[parseInt(e.parameter.id)].join(',');
return ContentService.createTextOutput(outString).setMimeType(ContentService.MimeType.TEXT);
}
  1. Have you deployed it properly?
  2. Have you set Authorization for anyone while deploying ?
  3. For every single save/add/delete in script need to deploy again.
1 Like

I have already set authorization and deploy at first
now i change my scrip but still not work

TypeError: Cannot read properties of undefined (reading ‘getDataRange’) ( 45th line file name “id”))

from 47th line ( outString += rg[parseInt(e.parameter.id)].join(’,’); )
turn into 45th (var rg = sh.getDataRange().getValues(); )

Please take this url and paste into a browser and see the response
image

Do you mean new script url right?
As I reply, After edit script I have already deploy and replace url but not working

Not a script url!!! you will hit button to read all records na, that time debug this web url , take the complete url and paste into browser and see

1 Like

oh i’m sorry
ok i will try next time. I’m grateful for your help. have a nice day

See, sample this is my ReadRecord weburl


https://script.google.com/macros/s/AKfycbz0ajKy_M1E8j9yXk-ysbq8rmVmXMZmU-c6d4mmZr02mqEQE5nnVl-U3lfNarUWWcC2/exec?func=ReadRecord&id=2

result

image

Sheet

image

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