将xlsx从网址导入Google工作表

时间:2015-12-15 09:00:26

标签: excel function google-sheets spreadsheet google-apps

在GoogleDocs中,我尝试使用导入功能(例如= importdata)从在线XLSX文件中提取数据或打开在线XLSX文件。一个例子是下面的网址:

http://www.sportsbookreviewsonline.com/scoresoddsarchives/nba/nba%20odds%202015-16.xlsx

理想情况下,我希望每次打开Goog​​le工作表时自动上传此文件。数据恢复损坏,但确实提到了.xml位置。

1 个答案:

答案 0 :(得分:0)

这应该这样做。

Public Sub OpenWebXLS()
' *************************************************
' Define Workbook and Worksheet Variables
' *************************************************
Dim wkbMyWorkbook As Workbook
Dim wkbWebWorkbook As Workbook
Dim wksWebWorkSheet As Worksheet

Set wkbMyWorkbook = ActiveWorkbook

' *************************************************
' Open The Web Workbook
' *************************************************
Workbooks.Open ("http://www.sportsbookreviewsonline.com/scoresoddsarchives/nba/nba%20odds%202015-16.xlsx")

' *************************************************
' Set the Web Workbook and Worksheet Variables
' *************************************************
Set wkbWebWorkbook = ActiveWorkbook
Set wksWebWorkSheet = ActiveSheet

' *************************************************
' Copy The Web Worksheet To My Workbook and Rename
' *************************************************
wksWebWorkSheet.Copy After:=wkbMyWorkbook.Sheets(Sheets.Count)
wkbMyWorkbook.Sheets(ActiveSheet.Name).Name = "MyNewWebSheet"

' *************************************************
' Close the Web Workbook
' *************************************************
wkbMyWorkbook.Activate
wkbWebWorkbook.Close

End Sub

我从这里得到99.9%。

https://social.msdn.microsoft.com/forums/office/en-US/efdd909d-f564-4bb5-9e72-db0346e5f82f/excel-vba-import-worksheet-from-url