Created
June 21, 2017 13:35
-
-
Save geekygrappler/6e97fc060e400fa95ec82479e5559ae9 to your computer and use it in GitHub Desktop.
Google sheets script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]}; | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
looks like it should be okay