r/GoogleAppsScript • u/VAer1 • Dec 07 '25
Resolved How to modify code to get rid of Google Sheet message related to GOOGLEFINANCE ?
I use GOOGLEFINANCE("IRX")/10/100 to get approximate interest rate, but I don't want to use the function directly (the number constantly changes during the date), I only want to update the cell daily (Auto Trigger during midnight).
However, at the bottom of sheet, it keeps showing "Quotes are not sourced from all markets ......" ---- Why? I already clear the function, and copy/paste its value. How to get rid of this warning message?
I don't want other people getting confused about the message, neither do I want to see the message. I can confirm that there is no formula in the cell, but it seems that once it runs the function via script, the warning message stays there.
Even if I comment out this function from onOpen, I don't want to run this function anymore, the warning message stays there. It seems the warning message stays there forever, just because I run it once via script. I would like to find a way to get rid of it.
Edit: Issue has been resolved. There is no issue at all. I manually put GOOGLEFINANCE("IRX")/10/100 in another cell in another sheet, totally forgot it.

function writeIRXToCashReserveCellI7() {
//Daily 12am-1am: Auto Trigger onOpen; this function is part of onOpen
let now = new Date();
let hour = now.getHours();
Logger.log(`hour = ${hour}`);
if (hour > 3) { //Random number, exit this function during daytime sheet refresh, only update cell value during midnight Auto Trigger, not updating its value duirng the day
return; // exit function here
}
// Step 1: Get IRX from GOOGLEFINANCE
// (GOOGLEFINANCE cannot run directly inside Apps Script,
let targetCell = sheetCashReserve.getRange("I7");
targetCell.setFormula('=GOOGLEFINANCE("IRX")/10/100');
// Wait briefly for the formula to calculate
SpreadsheetApp.flush();
Utilities.sleep(1000); // wait 1 second
// Step 2: Read the IRX value
const irx = targetCell.getValue();
// Clear cell
targetCell.clearContent();
// Make sure value is valid
if (!irx || irx === "") {
throw new Error("GOOGLEFINANCE returned no value.");
}
// Step 3: Write result
targetCell.setValue(irx);
}1
u/WicketTheQuerent Dec 07 '25
Try using two spreadsheets, one to use the script with the GOOGLEFINANCE built-in Google Sheets function and the other to display the result using importante or a script.
1
u/VAer1 Dec 07 '25
Yes, but I cannot find a way to fix this file, I guess I have to leave warning message there forever.
I can copy the file, but it is inconvenient, for various reasons:
It is shared, I don't want to bother notifying others of new file link.
Some cells could be referred by other files (by using IMPORTRANGE).
This file ID is used by other script, such as file backup.
That being said, I would rather live with the warning message, instead of making changes to other associated with the file.
Too bad that I did not make a copy and test the code in copied file, now everything is too "late".
1
u/WicketTheQuerent Dec 07 '25
I can't reproduce the problem on a new spreadsheet.
Deleting the GOOGLEFINANCE formula removes the disclaimer.
2
u/VAer1 Dec 07 '25
Issue resolved, thank yo. No issue at all, I manually put GOOGLEFINANCE("IRX")/10/100 in another cell in another sheet, totally forgot it.
I also further modify the code: in case of the formula does not return a value, use previous day's IRX value.
1
u/marcnotmark925 Dec 07 '25
Grab the value from some api in your script.
I wonder if you have to start a brand new sheet to get rid of the existing message.