Open AngelTs opened 2 years ago
The only one solution i found is to use "Query from JavaScript" instead of "Query in the Data Source URL", but this method is a little slower than Data source URL
Here is the method "Query from JavaScript": var searchterm = 'some text..."...some text'; var opts = {sendMethod: 'auto'}; var query = new google.visualization.Query("https://docs.google.com/a/google.com/spreadsheets/d/12837746123782738727321897239812738712/gviz/tq?tqx=out:json", opts); query.setQuery('select A,B,C,D,E,F where lower(A) contains LOWER(' + '"' + encodeURIComponent(searchterm) + '"' + ')'); query.send(handleQueryResponse);
I'm glad you found a way to make it work, and that you posted about it. This will help others, and it will help us figure out whether there is a solution that still allows you to construct the query URL yourself.
Even with escaping of " with \" or \u0022 or " or
%22
not work!var searchterm = 'some text..."...some text'; Data source URL = "https://docs.google.com/a/google.com/spreadsheets/d/12837746123782738727321897239812738712/gviz/tq?tqx=out:json&tq=SELECT%20A%20WHERE%20LOWER(A)%20CONTAINS%20" + "LOWER(" + '"' + encodeURIComponent(searchterm) + '"' + ")",
The short error is: Invalid query: PARSE_ERROR: Encountered \u0022 \u003cUNEXPECTED_CHAR\u003e \u0022. \u0022\u0022 at line 1, column 64.
The hole error is: {"version":"0.6","reqId":"0","status":"error","errors":[{"reason":"invalid_query","message":"INVALID_QUERY","detailed_message":"Invalid query: PARSE_ERROR: Encountered \u0022 \u003cUNEXPECTED_CHAR\u003e \u0022. \u0022\u0022 at line 1, column 64.\nWas expecting one of:\n \u0022,\u0022 ...\n \u0022)\u0022 ...\n \u0022\u0022 ...\n \u0022+\u0022 ...\n \u0022-\u0022 ...\n \u0022/\u0022 ...\n \u0022%\u0022 ...\n \u0022\u0022 ...\n \u0022/\u0022 ...\n \u0022%\u0022 ...\n \u0022+\u0022 ...\n \u0022-\u0022 ...\n \u0022,\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022 ...\n \u0022)\u0022