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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP to Google Calendar or Such 2

Status
Not open for further replies.

mydocpro

Technical User
Mar 13, 2016
48
US
'Looking for a way to export VFP data (single record at least) to my Google Calendar. (I searched for about an hour and am stumped)

Any thoughts?

Utmost thanks and blessings,
Philip
 
Yes, this is easy.

First, you need to create a DBF or a cursor with specific fields in a specific format. As a minimum, you need two fields: Subject (that is, the title of the event) and Start Date. Fill the cursor with your data for those fields.

Next, export the contents of the cursor to a CSV file. If you don't know how to do that, check the VFP Help for the COPY TO command.

Finally, in Google Calendar, go to Settings (that's under the "gear" icon) / Calendars / Import Calendar / Choose File. Navigate to the CSV file that you just created.

The CSV file can contain other fields: Start Time, End Date, End Time, whether it is an all-day event, whether it is a private event, and a longer description of the event. It is important to get these in the right order and the right format.

For full details of the format and layout of the data, see under the heading "Advanced: Create or edit CSV or iCal files before importing".

Hope this helps.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you, Mike! That was extremely helpful. Albeit, this means importing the csv file from Google Calendar ... i.e., 7+ mouse clicks for the end-user.

... 7 clicks is certainly not bad if the csv file contains at least a couple line-rows of calendar entries. This may be the best I can hope for.

I suspect there is not a way to automate some (or all) of those 7 clicks in VFP-9 or Google Calendar ... or even Excel or a 3rd party.

... to directly export the csv file into Google Calendar from Visual Foxpro or such.

Again, utmost thanks and blessings for clearing the clouds and motivating me.

Philip
 
There is Google API to do such things as adding calendar appointments, but it's much more complicated than some clicks.

You can easily pave the way for users to work on their own Google calendar by simply adding a webbrowser control in some of your form and navigate to the universal "own calender" URL where any user will see his own calendar.

Bye, Olaf.
 
Glad you found that helpful, Philip.

The Google API would indeed enable you to aumtomate the whole process, but Olaf is right when he says that it is complicated. Unless you have a very large number of events to import, you would probably prefer to go with the interactive method.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Olaf and Mike,

Hmmm, we'd might save about 2 or 3 more clicks elaborating on Olaf's recommendation:
(assuming that URL is a constant)
Here the Google 'Import Calendar' button becomes immediately visible (to import the user's CSV file (CSV is easily generated by VFP routines))

The reason we'd desire google calendar (vs. Outlook) is that it seems to work nicely with iPhone/iWatch Calendar (my limited usage). iWatch is oft more 'burden than blessing' ... but a 'handy' iPhone/iWatch calendar might perhaps help make the iWatch less burdensome to tote around.

I'd also ponder if 'SendKeys' might help, like it does for Notepad, Word, Etc. But I'll spare you.
oWSH = CREATEOBJECT("wscript.shell")
oWSH.AppActivate("Notepad") && assumes Notepad is already running
oWSH.SendKeys("Hello world")

Utmost thanks and blessings!
Philip
 
> [pre][/pre]
Well, no, just the base url What the browser and google make of this automatically can change in the future, I wouldn't use the final URL the browser shows as better URL, it's not even a shortcut. It's something no working for everyone, my final URL will not include #settings-calendars_9, that's a name of one of your calendars only. I for example arrive at a different URL starting with so only start with this common and canonical URL, the rest will follow.

If a user is not logged in into google, he'll be asked to login, otherwise will show his main calendar. Don't make that any more complicated.

Bye, Olaf.
 
Thanks Olaf, I'll return it to the solid URL (The program works delightfully, btw. We now 'see' our appointments trinkling their way into iPhone AND iWatch (first time in history).[bigglasses]

Utmost blessings!
Philip

*P.S. The test code (for now):
LOCAL cDesktopPath, cSpecialFolder
nRec = RECNO('Visit')
cSpecialFolder = "Desktop"
WSHShell = CreateObject("WScript.Shell")
cDesktopPath = WSHShell.SpecialFolders(cSpecialFolder)
cDir = EVALUATE([cDesktopPath])
cEvents = ""
SELECT visit
nRec = RECNO('Visit')
LOCATE FOR visit.dos = DATE()
IF FOUND()
SCAN FOR !INLIST(Record," ") AND BETWEEN(visit.dos,DATE(),DATE()+7) && visit.dos = DATE()
cSubject = STRTRAN(ALLTRIM(last_name)+IIF(!EMPTY(First_name),"-"+ALLTRIM(First_name),""),",") && no commas allowed
cDate = Alltrim(Str(Month(visit.Dos))) +"-"+Alltrim(Str(Day(visit.Dos)))+"-"+Right(Str(Year(visit.Dos)),2)
cEvents = cEvents+CHR(13)+CHR(10)+cSubject+","+cDate+","+ALLTRIM(time)
ENDSCAN
ENDIF
GO nRec
STRTOFILE("Subject,Start date,Start time"+cEvents,cDir+"\To "+cDate+" DPW.csv")
ShellExecute(0,"Open","
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top