Accent from mit app inventor to google sheet

53 views
Skip to first unread message

Bastien D.

unread,
May 3, 2019, 6:24:25 AM5/3/19
to MIT App Inventor Forum

Hello everybody !

I have an application that communicate with Google Sheets. I post text from app inventor to my google sheets.

To do that I have one Web componement which is calling a script with .PostText
Here is the script :

function doPost(e){
 
 
var ss = SpreadsheetApp.openByUrl("#URLOFGOOGLESHEETS")
 
var sheet = ss.getSheetByName("Valeurs");


  addText
(e,sheet);


}


function addText(e,sheet) {


 
var Date = e.parameter.Date;
 
var NumeroDeChantier = e.parameter.NumeroDeChantier;
 
var LieuDeChantier = e.parameter.LieuDeChantier;
 
var Operateur = e.parameter.Operateur;
 
var NumeroDessai = e.parameter.NumeroDessai;
 
var Emplacement = e.parameter.Emplacement;
 
var TypeSol = e.parameter.TypeSol;
 
var TypePlaque = e.parameter.TypePlaque;
 
var Commentaires = e.parameter.Commentaires;
 
var Essai = e.parameter.Essai
 
  sheet
.appendRow([Date, NumeroDeChantier, LieuDeChantier, Operateur, NumeroDessai, Emplacement, TypeSol, TypePlaque,Commentaires, Essai]);

It works but not when I send a word with an accent.
My question is : How can I send text with accent to the google sheets?

Thank you so much for your answer !!!
Bastien.

TimAI2

unread,
May 3, 2019, 7:08:31 AM5/3/19
to MIT App Inventor Forum
Possibly?:


Try adding .getDataAsString('ISO-8859-1')   < or another more suitable character set

to your parameters or the whole of "e" in your apps script

Bastien D.

unread,
May 3, 2019, 7:31:17 AM5/3/19
to MIT App Inventor Forum
I try it and it doesn't work sadly :(

TimAI2

unread,
May 3, 2019, 7:34:23 AM5/3/19
to MIT App Inventor Forum
Let me do some more investigation...

TimAI2

unread,
May 3, 2019, 8:23:50 AM5/3/19
to MIT App Inventor Forum
While i am looking try:

.getDataAsString()

(nothing in the brackets)

TimAI2

unread,
May 3, 2019, 8:34:51 AM5/3/19
to MIT App Inventor Forum
I have just tested a google apps script that sends to a google sheet and sent it a string of accented characters which arrived OK on the spreadsheet
Admittedly I used the browser and not an app...

Bastien D.

unread,
May 3, 2019, 8:41:54 AM5/3/19
to mitappinv...@googlegroups.com
I exactly do the same and it works too.

The problem comes from the communication bettween App inventor and the script.
 
Is the problem come from "sending data's" ? Or receiving data's ?

I tried to post the text with different Encoding but nothing works. 

Capture.PNG


Peter Mathijssen

unread,
May 3, 2019, 8:47:30 AM5/3/19
to MIT App Inventor Forum
What if you replace your accent character with the responding ascii code and in your google script replace the code with the character? Maybe that's done automatic. Never tested it just an idea.

Bastien D.

unread,
May 3, 2019, 9:02:18 AM5/3/19
to MIT App Inventor Forum
Sorry i don't understand clearly !

What should I send ? 
And how can I replace it ?

Bastien D.

unread,
May 3, 2019, 9:16:13 AM5/3/19
to MIT App Inventor Forum
I try to send character with encoding ASCII and it returns "?"

Peter Mathijssen

unread,
May 3, 2019, 9:24:16 AM5/3/19
to MIT App Inventor Forum

TimAI2

unread,
May 3, 2019, 9:28:24 AM5/3/19
to MIT App Inventor Forum
Solution: use the uriencode block on your parameter only:

e.g.

blocksSpecialCharactersEncode.png


Bastien D.

unread,
May 3, 2019, 9:32:59 AM5/3/19
to mitappinv...@googlegroups.com
Oh thank you so much , it works perfeclty !!!! 

I tried to do that but before the block "join" :( !!

Have a nice day :)
Reply all
Reply to author
Forward
0 new messages