[ad_1]
I Found this VBA code from https://www.youtube.com/watch?v=wYXf6vyomCk,
Iam trying to import data from Google Sheets into Excel but one or more values are not retrieved, what’s wrong, is there any solution?
Sub QueryGoogleSheets()
Dim qt As QueryTable, url As String, key As String, gid As String
If ActiveSheet.QueryTables.Count > 0 Then ActiveSheet.QueryTables(1).Delete
ActiveSheet.Cells.Clear
key = "1_27rjNQmlXrwVKpLWUbGrJYPJufGRa7Dk-XEKcNAHr0"
gid = "1628955556"
url = "https://spreadsheets.google.com/tq?tqx=out:html&key=" & key _
& "&gid=" & gid
Set qt = ActiveSheet.QueryTables.Add(Connection:="URL;" & url, _
Destination:=Range("a1"))
With qt
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.Refresh
End With
End Sub
To reproduce the problem run the code above and it will populate the Excel Sheet, however if you compare the data in the Sheet to the webpage its not retrieving all the information:
[ad_2]