Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Read list of URLs from cell range #238

Open
yodog opened this issue Jun 24, 2022 · 1 comment
Open

Read list of URLs from cell range #238

yodog opened this issue Jun 24, 2022 · 1 comment

Comments

@yodog
Copy link

yodog commented Jun 24, 2022

enhancement: read list of URLs from cell range

/**
 * Read list of URLs from range
 * Ex1: ImportJSON_RASG("sheet9!C2:C7")
 * Ex2: ImportJSON_RASG("myNamedRange")
 */

function ImportJSON_RASG(cellRange, query, parseOptions) {
  var arr = [];
  SpreadsheetApp.getActiveSheet().getRange(1,1).activate();
  const arrURL = SpreadsheetApp.getActiveSheet().getRange(cellRange).getValues().join().split(',');
  for (var url of arrURL) {
    try { arr.push(ImportJSON(url, query, parseOptions)); } 
    catch { SpreadsheetApp.getActiveSpreadsheet().toast(url, 'Error fetching data', 3); }
  }
  return arr.flat();
}
@wenson
Copy link

wenson commented Jul 30, 2022

it's not work .
sad :《

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants