0
/**
 * Get Volume .
 * @customfunction
 * @param {string} companyId
 * @param {string} date
 */
async function getVolume(companyId, date) {
  //You can change this URL to any web request you want to work with.
  var myHeaders = new Headers();
  myHeaders.append(
    "Authorization",
    "Bearer token_value"
  );
  var requestOptions = {
    method: "GET",
    headers: myHeaders
  };

  const url = `url value`;
  const response = await fetch(url, requestOptions);
  console.log(response);
  //Expect that status code is in 200-299 range
  if (!response.ok) {
    throw new Error(response.statusText);
  }
  const jsonResponse = await response.json();
  return jsonResponse;
}

当我使用邮递员提出请求时,它可以工作,但在 excel scriptlab 中出错。请任何人都可以指导我进行修复以解决此错误。

4

0 回答 0