urlfetch

Facebook Graph API not working on UrlFetchApp

不想你离开。 提交于 2021-02-18 19:00:53
问题 I run a query on Facebook Graph API Explorer successfully but when I run the same query on Google Apps Script with UrlFetchApp I get an Error - Invalid argument . The query is this: https: //graph.facebook.com/v4.0/act_1015703131******/insights?fields=spend&level=account&date_preset=yesterday&filtering=[{field:campaign.name,operator:CONTAIN,value:perf},{field:adset.name,operator:NOT_CONTAIN,value:rmk}]&access_token=******** When I run the same query without filtering it works as expected!

find this error in my code TypeError: Cannot read property 'getLastRow' of null (line 5, file “Code”)

点点圈 提交于 2021-02-15 07:48:08
问题 function prices() { var scraperSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("prices") var lrow = scraperSheet.getLastRow(); for (var i=2;i<=lrow;i++) { var regEx = /<span id="priceblock_dealprice.*<\/span>/gi var getContent = UrlFetchApp.fetch("https://www.amazon.in/"+scraperSheet.getRange(i,1).getValue()).getContentText().trim(); var price = getContent.match(regEx) price = price[0]; price = price.replace('<span id="priceblock_dealprice" class="a-size-medium a-color-price

UrlFetchApp.fetch() error, doesn't seem to be using headers

自作多情 提交于 2021-02-10 05:39:39
问题 Trying to grab data from a website using Google Apps Script to put it directly into a spreadsheet. The fetch does not seem to be working, where the Python requests equivalent works just fine. Python code: page = requests.get("someurl?as_data_structure", headers={'user-agent':'testagent'}) GAS code: var page = UrlFetchApp.fetch("someurl?as_data_structure", headers={'user-agent':'testagent'}); The only required header is the user-agent, and the error I am getting from the GAS code is what I

login and fetch url Google Apps Script

久未见 提交于 2021-02-08 10:49:42
问题 I am trying to fetch data from this website into my google spreadsheet using Google Apps Scripts: https://net.statev.de/#/pages/buisness/storage/5aec8c9a3b82972b99e741c6 And need to login here first: https://net.statev.de/#/login This is the function i came up with: function fetch() { var loginURL = 'https://net.statev.de/#/login'; var dataURL = 'https://net.statev.de/#/pages/buisness/storage/5aec8c9a3b82972b99e741c6'; var loginPayload = { 'email':'testmail', 'password':"test", }; var

Google Apps Script/URLFetchApp and using returned data

旧城冷巷雨未停 提交于 2021-01-29 20:11:36
问题 I am very new to this, so please bear with me-- I have currently have an operational google apps script on the backend of a google sheet that is generated from Google Form answers. I am essentially setting up a ticket form in google forms that will trigger the data in the corresponding sheet to be sent via api call to our ticketing system. It works great, but I am trying to optimize it currently. The goal is to take the json response I get using: Logger.log(response.getContentText()); which

Google Apps Script - Fetch data from third party API with date parameter

让人想犯罪 __ 提交于 2021-01-29 08:05:14
问题 One of my vendors has created an API that I can use to pull data. I'm trying to use google apps script for this as I can easily schedule the data pull on it. I've used the UrlFetchApp before but I'm lost with this as I have to pass an additional parameter in it for a date - I don't know how to do this and I would appreciate your help figuring this out. The instructions given to me are these: url = "https://xxxxx.com/api/leads/" method = POST //Request JSON format: (date format should be ‘Y-m

Why can't I get my UrlFetchApp.fetch to use the doGet()?

≯℡__Kan透↙ 提交于 2021-01-28 00:51:09
问题 If I use two forms that are both the same but one has a method of GET and one has a method of POST when I run them one uses the doGet and the other uses the doPost(). But that doesn't happen when I do the same thing with the UrlFetch() command by providing the input from a Prompt. The html: The top form is a GET and the bottom form is POST. <!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> <h3>GET</h3> <form action="https://script.google.com/a/cooper/macros/s

Google visualization API (gviz) query and fetching data from a spreadsheet

风格不统一 提交于 2021-01-27 21:29:00
问题 I am using the Google Visualization API to query a spreadsheet. If I paste the URL in the browser: https://docs.google.com/spreadsheets/d/14dIMLkVwHRo-bkvdIhaDwC-rGBHLefftlC6CCCs5YrWSc/gviz/tq?sheet=customers&tq=select+*+Where+A='27938' A is the customer ID column. I get this JSON looking text back: google.visualization.Query.setResponse({"version":"0.6","reqId":"0","status":"ok","sig":"7671558882","table":{"cols":[{"id":"A","label":"ID","type":"string"},{"id":"B","label":"FirstName",..... 1)

Unexpected error on UrlFetchApp.fetch in Google Apps Script using basic authentication

你离开我真会死。 提交于 2020-12-17 18:38:27
问题 I have the following code in Google Apps Script which retrieves CSV data from a webpage via HTTP using basic authentication and places it into a spreadsheet: CSVImport.gs function parseCSVtoSheet(sheetName, url) { // Credentials var username = "myusername"; var password = "mypassword"; var header = "Basic " + Utilities.base64Encode(username + ":" + password); // Setting the authorization header for basic HTTP authentication var options = { "headers": { "Authorization": header } }; // Getting

Unexpected error on UrlFetchApp.fetch in Google Apps Script using basic authentication

泄露秘密 提交于 2020-12-17 18:37:20
问题 I have the following code in Google Apps Script which retrieves CSV data from a webpage via HTTP using basic authentication and places it into a spreadsheet: CSVImport.gs function parseCSVtoSheet(sheetName, url) { // Credentials var username = "myusername"; var password = "mypassword"; var header = "Basic " + Utilities.base64Encode(username + ":" + password); // Setting the authorization header for basic HTTP authentication var options = { "headers": { "Authorization": header } }; // Getting