【发布时间】:2015-11-23 23:59:38
【问题描述】:
我需要帮助来自动化我从 BigQuery 将数据导入 excel 的过程。我使用本教程https://www.youtube.com/watch?v=udZNmb3QFQI 并成功从 BigQuery 获取数据。现在对于自动化过程,我在 excel 中记录了一个宏,并生成了如下代码:
子宏4()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://bigquery-connector.appspot.com/data", Destination:=Range("$C$8") _
)
.Name = "ExternalData_4"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.PostText = _
"q=[""Query"", ""Enter a query:""]&p=[""Project"",""Enter a project ID:""]&k=[""Key"", ""Enter your Connector Key:""]"
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = False
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = True
.Refresh BackgroundQuery:=False
End With
结束子
将此宏分配给 excel 中的按钮后,消息框再次要求我输入查询、项目 ID 和连接字符串。我不想每次都输入,因为我必须使用仪表板为我的项目自动执行此过程。请帮助我使用 Excel 中的 VBA 代码传递参数(查询、连接字符串和项目 ID)。
【问题讨论】:
标签: excel parameters google-bigquery vba