hi
I manage to post numerical data with the post block but not the character strings how should I proceed I am still looking
hi
I manage to post numerical data with the post block but not the character strings how should I proceed I am still looking
Share more detailsâŠ
hi
until now i sent numerical data in google sheets and it worked
I want to send text and itâs not working anymore
itâs a question of form I think but I havenât found it yet
here are the blocks :
The Query Parameters
for GAS (Google Apps Script) only accepts US-ASCII and your text has Ă« which is considered as an unsafe character.
You need to URL encode it.
[Edit]
Type this in the text and it should update the sheet correctly
Ma%C3%ABva
hi
I tried that before asking without success.
thank you for your support but I canât see myself doing this for each first name or text
hi
I went through different posts and I found this one attended by a certain API Master Muneer
that seemed to correspond to what I wanted to do well it saves in the spreadsheet only the first parameter
while when I try my script live I can write what I want numbers accented words or not
Iâm still looking for a solution
You are using GAS (Google Apps Scrip) which has to ways to write to the sheet
When using doGet(), you have to pass the parameters as part of the URL (Query Parameters) and therefore you need to convert them to a form accepted by the URL scheme. This is the reason why you have to change the text to URLEncoded text.
However, when you use doPost() you will pass the data using the Body block and therefore you can use all type of text and numbers.
You can pass a JSON formatted data in text form using the Body component and in the Google script side read the text and convert it using JSON.parse() to use it as an object and update the sheet.
See a post using doPost().
hi
so far i was consuming json i had saved in sheets or firebase
it gets stuck
Iâm trying to send a simple json string
and I want the script to send it back to me and even that doesnât work
You are using the ContentService
to return text but var j
is a JSON object not a text. If you want text to be return then you do not need to convert the e.postData.contents
The Failed to fetch data message requires to run the API from your phone not from the computer.
Follwoing is the easiest way to post data to Google sheet.
function doGet(e) {
Sheets.Spreadsheets.Values.append({"majorDimension":"ROWS","values": [[e.parameter.name ,e.parameter.age]]},
[[ Google Sheet ID ]],
[[ Sheet name ]] + "!A:A",
{valueInputOption:"USER_ENTERED"});
return ContentService.createTextOutput("Updated");
}
The sheet needs to be Shared for this to work. Please note that I used name and age from your code. You can use the proper parameter names.
If your script is already inside the Google sheet then you can use the following:
function doGet(e) {
Sheets.Spreadsheets.Values.append({"majorDimension":"ROWS","values": [[e.parameter.name, e.parameter.age]]},
SpreadsheetApp.getActiveSpreadsheet().getId(),
SpreadsheetApp.getActiveSpreadsheet().getSheets()[0].getSheetName() + "!A:A",
{valueInputOption:"USER_ENTERED"});
return ContentService.createTextOutput("Updated");
}
This will add the values to the first sheet in the Google sheet file.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.