Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Google Doc Spreadsheet

Status
Not open for further replies.

Swi

Programmer
Feb 4, 2002
1,963
US
Has anyone tried to use VB6 to save a Google Doc Spreadsheet as a CSV or XLS document?

If so, can you point me to any examples or documentation?

Thanks.

Swi
 
Thanks. Guess I'll have to delve into .NET.

Swi
 
Could be your only choice.

Whether by error or on purpose the GData 3.0 specs are not visible to the public, forcing you to use only the provided API libraries now. Without specs you can't even write a VB6 API library if you wanted to go to the trouble.
 
Did a bit more research. Seems a bit overkill to me for using .NET and the Google Sheets API.

Why not simply Publish the Google Doc as a CSV to the web and then just write a simple routine in VB6 to download.

There is even a checkbox that says Automatically republish when changes are made.

I have this working and took 10 minutes. Is there a reason someone would not do it this way?

Code:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, _
ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Private Sub Command1_Click()
    Dim done
    Dim myLink As String
    
    myLink = "[URL unfurl="true"]https://docs.google.com/spreadsheets/d/1_XXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXX/pub?gid=0&single=true&output=csv"[/URL]
    If Dir("C:\Test\Test.csv") <> vbNullString Then Kill "C:\Test\Test.csv"
    
    done = URLDownloadToFile(0, myLink, "C:\Test\Test.csv", 0, 0)

    If done = 0 Then
        MsgBox "File has been downloaded!"
    Else
        MsgBox "File not found!"
    End If
End Sub

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top