下面的代码运行良好,并从Google Sheet Web链接导入数据。
下面的代码额外添加了第一行和第一列,而这在Google Sheets中是不可用的。
我正在寻找的解决方案是从Excel工作表中删除第一行和第一列,因为这些在谷歌工作表中不可用。我想把活页上能买到的东西复印一下。
或者有没有什么方法可以让它自动化,我不必运行宏来从谷歌表单中获得更新的结果。它应该在Excel Byval函数工作时自动更新它。
希望有人能帮助我,我真的很感谢你阅读我的问题!
Private Sub CommandButton1_Click()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://docs.google.com/spreadsheets/d/e/2PACX-1vRv93GZ5W-yFbfSzApjQs2d3N4RQte4E1lKKMpe_Ykqc2S6wMqqvq5I8qv8hLntJ_70Eg0ktscwaypH/pubhtml", 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 = False
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "0,1"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
看看这个。
https://trumpexcel.com/vba-delete-row-excel/
此外,您还可以在打开工作簿时自动运行Excel宏。这里有一个简单的例子。
Private Sub Workbook_Open()
' Put your code here
End Sub