如何将Google电子表格导入Excel

时间:2018-06-25 16:22:27

标签: excel vba

请帮助我解决以下问题。 我正在使用Google表单收集基于Google表格的数据。 现在,我希望使用“在Web上发布”方法将这些数据导入本地excel。 我没有Excel方面的经验。如何在excel下定义一个自动化过程以始终从网址读取数据?

谢谢

1 个答案:

答案 0 :(得分:0)

您没有提供要测试的链接,但是我怀疑通用的网络查询将为您完成这项工作。像其他任何类似的任务一样,打开Macro记录器并从Web导入电子表格数据。

Sub Basic_Web_Query()
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;https://docs.google.com/spreadsheet/ccc?key=0Ah4Bis8FTYfCdDJILVdYOG1EZEYtc1N3NF96dHZSYkE&usp=sharing#gid=0", Destination:=Range("$A$1"))
        .Name = "q?s=goog_2"
        .FieldNames = True
        .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,2"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub