花粉2

function myFunction() {
  const html = UrlFetchApp.fetch('https://xxxxx/xxxxx/kafun.html').getContentText();

  let date = Parser.data(html).from('<p style="text-align: center;"><span style="font-size: large;">').to('</span><span style="font-size: large;">新居浜地区</span></p>').build().replace('</span><span style="font-size: large;">', '');

  console.log(date);

  let tables = Parser.data(html).from('<table align="center" style="width: 321px; height: 77px; margin-right: auto; margin-left: auto;" border="2">').to('</table>').iterate();
  let entries = Parser.data(tables[1]).from('<td align="right">').to('</td>').iterate();

  let data = [];

  for (let entrie of entries) {
    let temp = entrie.match(/[0-9,]+個/) || ["0"];

    // console.log(temp)

    data.push(Number(temp[0].replace(",", "").replace("個", "")));
  }

  data.unshift(date);

  console.log(data);

  let sheet = SpreadsheetApp.getActiveSheet();
  sheet.appendRow(data);

}