Excel VBA WebQuery Import From Google Sheet some values ​are not taken

Viewed 120

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 if surrounding cells contain different types (number/text), what's wrong, is there any solution? Here's a link! in google sheet and result in excel (https://drive.google.com/file/d/13eKELcqoeOKltAYYjes-j-lLMQrgyFwH/view?usp=sharing)!

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:

https://spreadsheets.google.com/tq?tqx=out:html&key=1_27rjNQmlXrwVKpLWUbGrJYPJufGRa7Dk-XEKcNAHr0&gid=1628955556

1 Answers
Related