我在互联网上看过这种方法:Create Short URLs Using APIs and Google Docs
如何使用www.tinyurl.com使用此方法?
你能帮帮我吗?谢谢!答案 0 :(得分:0)
访问tinyurl api无需凭据。它很简单,只需要查询中的长URL:
http://tinyurl.com/api-create.php?url=<longUrl>
与参考文章类似的电子表格功能将是:
= importData(concatenate("http://tinyurl.com/api-create.php?url=",B1))
答案 1 :(得分:0)
= importData仅适用于googlesheets。 哪个回答了这个问题。
但是对于那些使用Excel的人,您可以使用VBA代码
Option Explicit
Public Sub tinyURL()
Dim qt As QueryTable
Dim ws As Worksheet
Dim Copy As Integer
Dim Paste As Integer
Dim i As Integer
Dim URL As String
i = 2
Copy = 2
Paste = 2
Set ws = ThisWorkbook.Worksheets("Sheet1")
'loops until column A is empty
Do Until IsEmpty(Cells(i, 1))
'Copy from list in Column A and paste result into column B
URL = "INSERT THE TINYURL API URL HERE ENDING WITH =" & Range("A" & Copy)
Set qt = ws.QueryTables.Add(Connection:="URL;" & URL, Destination:=ws.Range("B" & Paste))
With qt
.RefreshOnFileOpen = True
.FieldNames = True
.WebSelectionType = xlSpecifiedTables
.WebTables = 1
.Refresh BackgroundQuery:=False
End With
i = i + 1
Copy = Copy + 1
Paste = Paste + 1
Loop
End Sub