Coding Gossips [OFFICIAL]

Hmm. That’s strange.

2 Likes

Code:

Just make a new one and share code here

3 Likes

sorry i cannot help with that (not hs coding language)

4 Likes

If I’m looking at this right you’re creating an html document with code for coloring but it’s not outputting any data to the forum, I’m not sure if you can even create a shortcut to do this
I could be wrong though, just a guess. :]
Plus I’m not sure if you’re allowed to share unapproved shortcuts so I’d check witha leader before sharing more even if they’re innocuous. :))

8 Likes

Hmm…its not appearing in my shortcuts even though I added it.
Not sure what to do about that.

4 Likes
2 Likes

Hi does anyone know how to fix:

SyntaxError: Unexpected token % in JSON at position 0 (line 3, file "Code")

In apps script?

I can’t see any thing there.

2 Likes

It looks like it’s something wrong with the JSON file that you’re loading.

You can validate JSON files using something like this website:

2 Likes

Do you have a % character in a JSON file somewhere? Line 0 should always include just a bracket.

Like William said, you can validate your JSON file by pasting it in the text box on that site, or if you’re using an editor like VSCode, I’m pretty sure there is a linter built in which automatically shows you your syntax errors.

2 Likes

Thanks. :slight_smile:

Thanks. But its position 0, line 3.

What I’m trying to do is to retrieve queries using e.parameters and then update a g sheets spreadsheet.

The strange thing is that I have another one that works and coincidentally it has the same amount of queries to find, so I copied it, pasted it and all I changed is the spreadsheet id (obviously) and the query names.

I’ll attach the code (I’ve censored some stuff):


var sheet = SpreadsheetApp.openById("CENSORED").getSheetByName('CENSORED');
function doGet(e) {
var One = JSON.parse(e.parameters.Query1)
var Two = JSON.parse(e.parameters.Query2)
var Three = JSON.parse(e.parameters.Query3)
var Four = JSON.parse(e.parameters.Query4)
var Five = JSON.parse(e.parameters.Query5)
var Six = JSON.parse(e.parameters.Query6)
var Seven = JSON.parse(e.parameters.Query7)

sheet.appendRow([One,Two,Three,Four,Five,Six,Seven]);}

My url is:

https://script.google.com/macros/s/ID/exec?Query1=%22something%Query2=%22something%22&Query3=%22something%22&Query4=%22something%22&Query5=%22something%22&Query6=%22something%22&Query7=%22something%22
1 Like

How do you anti plant it anyways?

1 Like

due to the fact that there’s no character limit for topic titles you can spam characters and it eventually pushes the plant button off the screen. my guess is i either didn’t put enough invisible characters for ipads and perhaps the web browser has different formatting as i tested on a phone and not a ipad.
another potential is that the unicode characters just don’t load for some people but i doubt that.
:]

4 Likes

Ooh. Cool. I’m gonna try it.

1 Like

Wait but @Temm isn’t the mushroom on the left side though

1 Like

@waffle have you seen the key?

5 Likes

what do you mean?

4 Likes

What does your sheet look like? Are you sure it’s outputting JSON?

It should, but… For some reason, the JSON.parse() function you’re running is finding a syntax error. I have a sneaky suspicion that your file is actually XML or CSV.

2 Likes

I swear its .gs

No it takes url parameters, defines variables as the parameter’s data and adds a row to my spreadsheet using those variables (appendrow).

Strangely I have another one working coincidently with the same amount of parameters that works. So i just copied and pasted it into this new one and changed the variable and parameter names and the sheet id.

1 Like

Sorry, not the Google Script file, but the spreadsheet file that you’re taking as input on line 1. The “JSON” file might not actually be valid JSON – you could try printing it in the console to check what what your data looks like.

Oh okay, I’m glad to hear it :)

1 Like

You mean press run? Spreadsheet file is just standard. Default. Same as the one that works.

1 Like