使用post方法运行导出需要花费太多时间

时间:2017-12-12 15:18:33

标签: facebook facebook-graph-api

我开发了一个Facebook应用程序,并对仪表板上的数据进行了一些离线分析。

我正在使用此处描述的导出API:https://developers.facebook.com/docs/analytics/export

根据您的解释,它应该花费大约1-2个小时但是,我在过去一周每天都这样做,我花了大约2天的时间来下载每个出口。

我的应用程序没有大量数据,每个导出都很小。

你能帮我理解我做错了什么,或者你出口服务有问题吗?

1 个答案:

答案 0 :(得分:0)

Sub OpenLatestResourceForecastFile()
'Declare the variables
Dim MyPath As String
Dim MyFile As String
Dim LatestFile As String
Dim LatestDate As Date
Dim LMD As Date
Dim MyData As Workbook
Set CopiedData = Workbooks("Resource Costing E3.xlsm").Sheets(4)
Set wb = ActiveWorkbook


'Specify the path to the folder
MyPath = "C\doc etc"

'Make sure that the path ends in a backslash
If Right(MyPath, 1) <> "\" Then MyPath = MyPath & "\"

'Get the first Excel file from the folder
MyFile = Dir(MyPath & "*.xls", vbNormal)

'If no files were found, exit the sub
If Len(MyFile) = 0 Then
    MsgBox "No files were found...", vbExclamation
    Exit Sub
End If

'Loop through each Excel file in the folder
Do While Len(MyFile) > 0

    'Assign the date/time of the current file to a variable
    LMD = FileDateTime(MyPath & MyFile)

    'If the date/time of the current file is greater than the latest
    'recorded date, assign its filename and date/time to variables
    If LMD > LatestDate Then
        LatestFile = MyFile
        LatestDate = LMD
    End If

    'Get the next Excel file from the folder
    MyFile = Dir

Loop

'Open the latest file and copy Pivot Data Tab
Workbooks.Open MyPath & LatestFile
Worksheets("Pivot Data").Copy After:=CopiedData

End Sub