使用VBA从Google电子表格导入范围

时间:2018-05-21 19:27:19

标签: excel vba google-sheets

我的代码是导入Google电子表格中的所有内容,包括行号和列标题。

如何导入特定范围的工作表?

Sub Basic_Web_Query()
With ActiveSheet.QueryTables.Add(Connection:= _
  "URL;https://docs.google.com/spreadsheets/d/11H_-UFOpNAtQbs5BNOwZZK1KBew6l-8XKmoMycWuizU/edit?usp=sharing", Destination:=Range("$A$1"))
  .Name = "q?s=goog_2"
  .FieldNames = False
  .RowNumbers = False
  .FillAdjacentFormulas = False
  .PreserveFormatting = True
  .RefreshOnFileOpen = False
  .BackgroundQuery = True
  .RefreshStyle = xlInsertDeleteCells
  .SavePassword = False
  .SaveData = True
  .AdjustColumnWidth = True
  .RefreshPeriod = 0
  .WebSelectionType = xlSpecifiedTables
  .WebFormatting = xlWebFormattingNone
  .WebTables = "1"
  .WebPreFormattedTextToColumns = False
  .WebConsecutiveDelimitersAsOne = True
  .WebSingleBlockTextImport = False
  .WebDisableDateRecognition = False
  .WebDisableRedirections = False
  .Refresh BackgroundQuery:=False
End With
End Sub

0 个答案:

没有答案