将数据从Google表格格式化为Excel

时间:2019-06-03 11:49:34

标签: excel vba google-sheets formatting

我有一个获取Google表格的函数,然后将其写入Excel表:

Function GetDataFromGoogle()
Dim i As Integer
  With Worksheets("Listing")
    With .QueryTables.Add  (Connection:="URL;https://docs.google.com/spreadsheets/d/1Rudp78FjmbWhtPMRLr6ItgIq0p_alzeSQKTVKlkOVA4/edit?usp=sharing", Destination:=Worksheets ("Listing").Range("$A$1"))
        .Name = "List"
        .PreserveFormatting = True
        .BackgroundQuery = True
        .WebFormatting = xlWebFormattingNone
        .Refresh BackgroundQuery:=False
    End With
    DoEvents
  End With
    For i = 1 To ThisWorkbook.Connections.Count
        If ThisWorkbook.Connections.Count = 0 Then Exit Function
        ThisWorkbook.Connections.item(i).Delete
        i = i - 1
    Next i

End Function

但是出于某种原因,在带有“ /”字符的单元格中,将复制日期格式。

我试图通过:: p强制在excel中设置格式

Worksheets("Listing").Columns(3).NumberFormat = "####.#"

之前或之后,但不起作用

0 个答案:

没有答案