有没有办法让Google Finance Stick进行货币换算?

时间:2019-05-30 12:28:30

标签: google-apps-script google-sheets copy-paste google-sheets-formula

我需要找到一种方法,将以下GoogleFinance公式的输出自动复制到另一个单元格中,并使其保持不变,即汇率变化时不变。

=A1*GOOGLEFINANCE("currency:AUDGBP")

我打算使用类似=value(x)的东西,但是每次上述公式生成新值时,这种情况都会改变,而我希望在输出答案后立即粘贴。

3 个答案:

答案 0 :(得分:1)

The GOOGLEFINANCE function has some optional parameters - one of them is the start date.

If you request the exchange rate for a particular date then it won't change later on.

=GOOGLEFINANCE("Currency:AUDGBP", "price", "05/31/2019")

The output is a little different - a range with the date and value rather than a single cell, but the value for the exchange rate is correct and won't change.

You can then use the INDEX function to extract just the exchange rate

=INDEX(GOOGLEFINANCE("Currency:AUDGBP", "price", "05/31/2019"), 2, 2)

As described here

答案 1 :(得分:0)

有很多选项,包括:

  • Ctrl + C ,然后按 Ctrl + Shift + V (但可能很乏味)
  • GAS(在SO的帮助下,您期望可以证明自己的努力或已经得到解决)
  • 打开迭代计算(但在您的情况下似乎不建议使用)
  • 也许来自我们尊敬的成员之一的Spreadsheet Freezer插件(我没有尝试过)

答案 2 :(得分:0)

如果您想玩按钮和脚本,那么:

function moveValuesOnly() { var ss = SpreadsheetApp.getActiveSpreadsheet();
                            var source = ss.getRange('Sheet1!A1');
                            source.copyTo(ss.getRange('Sheet2!A1'), {contentsOnly: true}); }

这会将值从 Sheet1!A1 复制到 Sheet2!A1


否则 CTRL + C CTRL +     SHIFT + V 用于手动复制