Skip to content

Instantly share code, notes, and snippets.

@geekygrappler
Created June 21, 2017 13:35
Show Gist options
  • Save geekygrappler/6e97fc060e400fa95ec82479e5559ae9 to your computer and use it in GitHub Desktop.
Save geekygrappler/6e97fc060e400fa95ec82479e5559ae9 to your computer and use it in GitHub Desktop.
Google sheets script
function updatePickupDate() {
var sheet = SpreadsheetApp.getActive().getSheetByName('pickupDateAlterations');
var data = sheet.getDataRange().getValues();
var ordersAndPickupDates = getOrdersAndPickupDates(data);
Logger.log(ordersAndPickupDates);
var options = {
method: "patch",
payload: JSON.stringify({"orders": ordersAndPickupDates})
}
UrlFetchApp.fetch('https://citypantry.localtunnel.me/orders/bulk-update-pickup-date', options);
}
function getOrdersAndPickupDates(data) {
data.shift();
return data.map(function(row) {
return {'orderId': row[0], 'pickupDate': row[2]};
})
}
@jak
Copy link

jak commented Jun 27, 2017

looks like it should be okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment