我在互联网上看到过这样的方法:使用API和Google创建短URL
如何使用www.tinyurl.com使用此方法?
你能帮帮我吗?谢谢!
发布于 2013-11-30 04:27:04
访问tinyurl api不需要凭据。它非常简单,只需要查询中的长url:
http://tinyurl.com/api-create.php?url=<longUrl>与引用的文章中类似的电子表格功能如下:
= importData(concatenate("http://tinyurl.com/api-create.php?url=",B1))参考资料:Tinyurl有一个API.
发布于 2019-04-29 01:39:50
=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 Subhttps://stackoverflow.com/questions/20192122
复制相似问题