function import_inventory_test(e) {
var options = {
"method": "GET",
"headers": {
'Content-Type': 'application/json',
'Prefer': 'code=200',
'Prefer': 'dynamic=true',
"clientId": "1",
"key": "1",
}
}
var text = UrlFetchApp.fetch("https://stoplight.io/mocks/flowhub/public-developer-portal/24055485/v0/inventory?max=100", options).getContentText();
var json = JSON.parse(text);
// I added the below script.
var values = json.data.map(({ sku }) => [sku]);
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); // Please set your sheet name.
sheet.getRange(1, 1, values.length).setValues(values);
}
如何使用以下字段填充a-d列(按此顺序):SKU(A)数量(B)产品名称(C)品牌(D)
1条答案
按热度按时间93ze6v8z1#
在你的脚本中,当你的脚本被修改时,下面的修改怎么样?
发件人:
收件人:
注:
json.data.map(({ sku, quantity, productName, brand }) => [sku, quantity, productName, brand])
。参考: