简体   繁体   中英

How to Import Historical Data from Yahoo Finance into Google Sheets and make it Auto-Update?

I've been trying to get Yahoo Finance ES symbol daily OHLC data into Google Sheet.

I've checked the disabling javascript and reloading the page method by @Rubén and the OHLC data displays after reloading the page. But the IMPORT formulas returns #N/A Resource at URL Not Found .

I also tried @user0 methods (save the IMPORTJSON one) here but no luck there too.

Then I've tested the script by @JohnA and it does retrieve the data.

Here's @JohnA Script output I got.

But now I'm wondering how to make it auto-update at least every day (it is daily data).

I'm not sure how to proceed since @JohnA's Script involves handling a CSV file.

I've enabled calculation on change and every minute as detailed here: How to Configure Auto Refresh for Googlesheets

Is there any workaround allowing to just get the data into Google Sheet without needing the csv step?

Or is it possible to still pull the data from the CSV while getting Google sheet to auto-update daily? If yes, how to do it?

Thanks for any advice, always very much appreciated!

The test Sheet1 and Sheet2

Related scripts by @Tanaike 1 @Tanaike 2

In script editor look for the clock

在此处输入图像描述

Then complete the form

在此处输入图像描述

Optionally, you can set a trigger via a script

/**
 * Creates time-driven triggers
 *
 * https://developers.google.com/apps-script/reference/script/clock-trigger-builder
 */
function createTimeDrivenTriggers() {
  // Trigger every day at 04:00AM CT.
  ScriptApp.newTrigger('csvDaily')
      .timeBased()
      .everyDays(1)
      .atHour(4)
      .create();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM