Lots of template work - Luminate, G2, Crayon. Added Mizuno Running's script. Small changes to notes.
This commit is contained in:
@ -19,7 +19,8 @@ def getfromName(baseUrlname, apiKey):
|
||||
if response.status_code == 200:
|
||||
print("200 Response!")
|
||||
else:
|
||||
print("Another error! " + response.status_code)
|
||||
print("Another error! ")
|
||||
print(response.status_code)
|
||||
response = response.json()
|
||||
# print(response)
|
||||
# uuid = response["data"][0]["id"]
|
||||
|
||||
1
Scripts/GoogleScripts/Mizuno_running_props/.clasp.json
Normal file
1
Scripts/GoogleScripts/Mizuno_running_props/.clasp.json
Normal file
@ -0,0 +1 @@
|
||||
{"scriptId":"1zpWkBv4TQb778uhXgOLNA_cLp5ENPmGHAP7tCJZ7ri41ocxfdAZCuLzp","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/Mizuno_running_props"}
|
||||
@ -0,0 +1,87 @@
|
||||
const sheet = SpreadsheetApp.getActiveSheet();
|
||||
const apiKey = 'XeRrtgm0BFYPjOjPekVwCdGkW';
|
||||
|
||||
function getUuids() {
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
var numRows = sheet.getLastRow()-1; // Number of rows to process
|
||||
var dataRange = sheet.getRange(2, 2, numRows, 1);
|
||||
var values = dataRange.getValues();
|
||||
writeHeadings();
|
||||
|
||||
for (email in values){
|
||||
var row = values[email];
|
||||
var email = row[0];
|
||||
var api_url = 'https://api.northpass.com/v2/people/?filter[email][eq]='+email;
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
};
|
||||
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||
var uuidResponse = sendMsg.getContentText();
|
||||
var parsedata = JSON.parse(uuidResponse);
|
||||
try {
|
||||
var uuid = parsedata["data"][0]["id"];
|
||||
if (email != "") {
|
||||
Logger.log(email)
|
||||
findRow(email, uuid);
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
Logger.log(ex)
|
||||
continue
|
||||
}
|
||||
finally {
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function findRow(email, uuid){
|
||||
var sheetRow = SpreadsheetApp.getActiveSpreadsheet();
|
||||
var data = sheetRow.getDataRange().getValues();
|
||||
for(var i = 0; i<data.length;i++){
|
||||
if(data[i][1] == email){ //[1] because column B
|
||||
Logger.log((i+1))
|
||||
var row = i+1;
|
||||
propstoSheet(uuid, row, email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function propstoSheet(uuid, row, email) {
|
||||
var uuid_url = 'https://api.northpass.com/v2/properties/people/'+uuid;
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
url: uuid_url,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey,
|
||||
}
|
||||
};
|
||||
const sendMsg = UrlFetchApp.fetch(uuid_url, settings);
|
||||
var txtResponse = sendMsg.getContentText();
|
||||
var parseProps = JSON.parse(txtResponse);
|
||||
Logger.log(parseProps)
|
||||
var role = parseProps["data"]["attributes"]["properties"]["city"];
|
||||
var user_id = parseProps["data"]["attributes"]["properties"]["state"];
|
||||
var paid = parseProps["data"]["attributes"]["properties"]["store_name"];
|
||||
|
||||
// Write the Data to each row and column
|
||||
sheet.getRange(row, 5).setValue(role);
|
||||
sheet.getRange(row, 6).setValue(user_id);
|
||||
sheet.getRange(row, 7).setValue(paid);
|
||||
// Logger.log(row + "," + email);
|
||||
}
|
||||
|
||||
function writeHeadings() {
|
||||
// Write the new Column Headings
|
||||
sheet.getRange(1, 5).setValue("City");
|
||||
sheet.getRange(1, 6).setValue("State");
|
||||
sheet.getRange(1, 7).setValue("Store Name");
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"timeZone": "America/New_York",
|
||||
"dependencies": {
|
||||
},
|
||||
"exceptionLogging": "STACKDRIVER",
|
||||
"runtimeVersion": "V8"
|
||||
}
|
||||
Reference in New Issue
Block a user