1F380.2615 1F380.2615 - 1 year ago 134
Smarty Question

Integrate Form Tools with Google Spreadsheets?

Does anyone have any experience with the open source Form Tools API? I'm trying to dynamically populate a google spreadsheet with data being stored in a MariaDB database that's running an installation of Form Tools.

I could try to write a script to have Form Tools automatically populate a csv with my data, which then would get pulled into google sheets with an IMPORTDATA function, but I'm not savvy enough with either PHP or Smarty Template to get this done in a timely manner.

Any leads on this would be much appreciated!

Answer Source

Hey in case anyone is trying to figure this out, I managed to do it pretty simply by using the ft_api_show_submissions function (from the official Form Tools API documentation) in a page on my server and an IMPORTXML function triggered every minute in the Google Spreadsheet's Script Editor.

The PHP on my own hosted page looks like this (with the formID, viewID, and ExportType as the function values):



   ft_api_show_submissions(1, 3, 1, $page);


And the Google Apps Script looks like this:

function getData() {
   var queryString = Math.random();
   var cellFunction = '=IMPORTXML("url"' + queryString + '","//div")';


This function pulls all of the divs generated by the PHP on the page I've published and spits their content into individual cells in my Google Spreadsheet.

To set the IMPORTXML function to auto-refresh I just put the function on a trigger that runs once every minute through the Apps Script UI.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download