Comment mettre du texte à la ligne dans le label

mmm, does it return any error? what do you get in responseContent in this case?

j'ai ce message d'erreur

et dans Do it j'obtients ce que je veux

Can you get the responseContent to see the error from googleSheet? The error you have shared is due to the responseContent is not formed as expected.

comme ça

That is not the responseContent received after call the web component. In the error you can see it starts by <!DOCTYPE....

We already talked in detail about the DOCTYPE error here

You might want to read the suggestions there again...

Taifun

voilà la réponse que j'obtient

J'ai testé autre chose : j'ai juste essayé de ne pas envoyer mon texte dans googlesheet, et là ça fonctionne , j'obtiens le même texte dans le Labeltext et Textbox (avec plusieurs lignes).
J'en conclu que le problème est la cellule de la googlesheet qui n'a pas plusieurs lignes !

If you remove the "Encode Uri" block, does it work?

here is your error message (see the highlighted text)


unfortunately it is blurry, because you provided a screenshot of bad quality
Taifun

j'avais déjà essayé de supprimer "Encode Uri" et je n'avais pas de message d'erreur mais ça ne fonctionnait pas

it is stored in one line or it doesn't store anything, what are you referring with it doesn't work?

il est sur une seule ligne

and with the encode block you have the error what did you show previously?

It is weird....I don't know why..maybe @TIMAI2 knows how to store a multiline text in a cell and recover it with no errors...(I feel like I'm calling Batman...)

image

I hear your call :wink:

A quick test on a google sheet shows that a cell that contains line returns is correctly returned to an app when the data is called back as a csv, e.g.

https://docs.google.com/spreadsheets/d/
1-2dQ_WjplEuXkN-5GYZaLGAhvulB6VaE0y8-aqd
/export?format=csv
&gid=19053903

Label:

aaa

bbb

ccc

It may be that something is happening to this data when it is manipulated by the google apps script in arrays etc.

1 Like

oui , avec le bloc d'encodage j'ai le message d'erreur.
Je pense que le problème c'est la cellule dans googlesheet qui reçoit les données sur une seule ligne et donc l'application lit les données de la cellule tel qu'elle est (sur une ligne).
Essayez de faire un test et vous verrez !

est ce qu'il faut garder le bloc "Encode Uri" ou non ?

j'ai mis les blocs comme ça, mais j'ai une erreur, j'ai obtenu la réponse ci-dessous

Capture5

image

You have not included a function (func) ?

Also your url is incorrectly formatted, you have two "?" and you cannot set parameters to an "export?format-csv" request other than the gid and the range.

image

image

image

I will do a test on uploading a text with line returns now

Aha !

image

image

function doGet(e) {
  var ss = SpreadsheetApp.getActive();
  var sh = ss.getSheetByName("Sheet2");
  var rng = sh.getRange("A1");
  rng.setValue(e.parameter.label);
  SpreadsheetApp.flush();
  var data = rng.getValue();
  return ContentService.createTextOutput(data);

}
1 Like