I have no reputation to comment on hurricaneditka16. So I posted this answer: This line
queryResults = BigQuery.Jobs.query(projectId, sql);
Should be replaced by
.query( resource, projectId);
Resource is a small sql conversion you used earlier. Try this conversion and it will work.
function getResource(sql) { var resource = '{"query": "sql"}' resource = resource.replace('sql', sql); return resource }
source share