【问题标题】:Automate the execution of a SQL script based on cell value in Google Sheets根据 Google 表格中的单元格值自动执行 SQL 脚本
【发布时间】:2018-01-18 19:32:09
【问题描述】:

我希望自动化以下过程:
当 GoogleSheet 中的单元格值 = "particularValue" ---> 执行 SQL 脚本 ---> 导出 CSV。

我们可以使用 VBA for Excel 做到这一点。 GSheet 的等效项是 Google Apps 脚本。
有人可以分享一个可以运行 SQL 脚本的 GAS 代码吗?

【问题讨论】:

    标签: sql google-apps-script google-sheets export-to-csv


    【解决方案1】:

    这可以通过 VBA 执行。打开工作表的“查看代码”并输入此子程序:

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target = "particularValue" Then 
            ' do something
        end if
    End Sub
    

    我需要有关 CSV 的 SQL 连接等的更多细节 - 但该问题已在其他地方提出。

    【讨论】:

    • 非常感谢您的回答。我将检查 VBA 选项是否在 Google sheet 中可用。 csv的最后一部分,我将使用SQL脚本中的函数导出数据选项。
    • 如果您使用的是谷歌表格,则不应将您的帖子标记为 [Excel]
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多