Posted on 10-15-2013 03:55 PM
I created this function for use in my scripting.
It requires a google Form and you put the ID in the curl command.
#!/bin/sh
GoogleLog()
{
#Variables Created: theaction - A descriptive Variable used to Describe the Common task being performed and logged
# misc - A variable that provides either the output of a command performed or provides data
#Actions Performed: Echos Needed details to the Terminal and Logs the same data to a Google Sheet.
case "$1" in
#Case allows you to have different formatting based on first returned value.
#Useful for certain tasks.
*)
echo "Log: "$1 $2 $3 $4 $5 $6 $7 $8
theaction="$1"
misc=$2+" "+$3+" "+$4+" "+$5+" "+$6+" "+$7+" "+$8
;;
esac
#Curl to Google
#echo "Logging in Google Sheet"
result=`2>/dev/null curl -k -d "entry.0.single=${GlobalVariable1}&entry.2.single=${GlobalVariable2}&entry.4.single=${theaction}&entry.6.single=${misc}&submit=ok" https://docs.google.com/a/gccaz.edu/spreadsheet/formResponse?formkey=(formid)`
return 0
}
This is in no way properly formatted and recent changes to google sheets and forms, may break it.