Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter cardboardmonet

    (@cardboardmonet)

    I figured part of it out.

    -Go to Contact Form DB > Contact Form DB
    -Select the form you’re interested in exporting.
    -At the very top there’s a drop down for Export (With “Advanced Export” below it). Go to “Google Spreadsheet Live Data”, and then follow the steps.

    But now I’m running into this error:

    error: Request failed for https://www.reuts.com/wp-login.php?redirect_to=wp-admin/admin-ajax.php%3Faction%3Dcfdb-export%26form%3DSubmission%2BForm returned code 406. Truncated server response: <!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”> <html><head> <title>406 Not Acceptable</title> </head><body> <h1>Not Acceptable</h1> <p>An appro… (use muteHttpExceptions option to examine full response) (line 66, file “Code”)

    If anyone has had success with this error, please let me know! Hope you have better luck than me ??

    Thread Starter cardboardmonet

    (@cardboardmonet)

    Somewhat fixed this error, but probably did so incorrectly. In the Script Editor, I hard-coded the path to my export (since I knew it was working):

    On line 62
    var url = "https://my-domain.tld/wp-content/plugins/contact-form-7-to-database-extension/export.php?form=myform";

    You can test the URL in your browser, and if a download starts you know you have the right path (make sure you’re already logged in).

    In the spreadsheet, fill out this request same as before:

    =CF7ToDBData("https://my-domain.tld", "form-name", "", "user", "pwd")

    And it should work. At least, I got it to work.

    Hopefully this helps someone else!

    Thread Starter cardboardmonet

    (@cardboardmonet)

    One final update (I hope)! To update almost automatically (this’ll add a “REFRESH” button in your menu which you have to hit to refresh data):

    function onOpen() {
      var sheet = SpreadsheetApp.getActiveSpreadsheet();
      var entries = [{
        name : "Refresh",
        functionName : "refreshLastUpdate"
      }];
      sheet.addMenu("Refresh", entries);
    
    };
    
    function refreshLastUpdate() {
      var fresh = SpreadsheetApp.getActiveSheet().getRange('RANDOM VARIABLE CELL').getValues();
      SpreadsheetApp.getActiveSpreadsheet().getRange('A1').setValue('=CF7ToDBData("YOUR URL", "FORM NAME", "", "USER NAME", "PASSWORD", "' + fresh + '")');
    }

    Add this to an out-of-the-way or hidden cell:

    =RANDBETWEEN( 1 ; 999 )

    And then whatever cell you’ve added that to, make sure you change the RANDOM VARIABLE CELL variable in the above code.

    This obviously isn’t the cleanest way to do what I’m looking to do (I’m no programmer), but it has helped me, and maybe someone with more experience can clean it up.

    jgompen

    (@jgompen)

    I hard coded the url as well, but now got this error:

    Request failed for https://www.rt103.nl/wp-content/plugins/contact-form-7-to-database-extension/export.php?form=wijn2013 returned code 500. Truncated server response: <!DOCTYPE html> <!– Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after… (use muteHttpExceptions option to examine full response). (line 66, file “Code”)

    Thread Starter cardboardmonet

    (@cardboardmonet)

    @jgompen

    When you click that URL (and are logged in to your WordPress account), does it retrieve the data, either on the page or with a download? I can’t test it, because I don’t have admin access to your WordPress (obviously), but if that doesn’t work, you either have a URL error or login error. I think.

    @cardboardmonet – thanks for the reply.
    When I go to the URL it downloads the file (when I am logged in).

    Thread Starter cardboardmonet

    (@cardboardmonet)

    @jgompen

    Hmm… then I can only assume there’s something wrong with your script that’s not signing Google Drive in to your WordPress admin correctly. I’d play around with that. Without seeing all the code, and having the ability to get in there myself, I can’t say for sure, though.

    Still looking for a fix for this

    Thread Starter cardboardmonet

    (@cardboardmonet)

    @dick Norise—

    What’s going on? The steps I’ve highlighted should work if you follow them to a “T.”

    Thanks for this step by step! Very helpful!

    Just one additional note that worked for me. If you are trying to get the form to automatically refresh, just follow all the steps above (including creating the “Refresh” button function) and then do the following:

    -> Open up your script editor with the script you are running for this spreadsheet
    -> Click on Resources
    -> Click Current project’s triggers
    -> Remove any existing triggers and then click Add a new trigger
    -> Select refershLastUpdate from the dropdown
    -> Change the second dropdown to Time-driven
    -> Change the last two dropdowns to however frequently you want the spreadsheet to refresh (e.g. “Minutes timer” and “Every 5 minutes”) (but be sure to be aware of Google doc’s quota limits)
    -> Press Save on this box
    -> Press Save for the overall script

    Now the spreadsheet should automatically update with the latest form entries at the frequency you specified!

    Plugin Author Michael Simpson

    (@msimpson)

    Thank you for this.

    Where can I get the js for CF7ToDBData method?

    Plugin Author Michael Simpson

    (@msimpson)

    Don’t use CF7ToDBData anymore. Update to the latest version.

    1. Go to the Short Code Builder admin page.
    2. Choose Export = Google Live Data.
    3. Pick your form and options
    4. The page will generate a function to paste into you Google spreadsheet. You no longer need to add additional script code.

    So, I’m not a coder…but I’ve got everything working except the ‘Refresh’ menu. Every time I click on it, I see #NAME? Error: Unknown function: ‘CF7ToDBData’.

    The link from ‘Export = Google Live Data’ shows the correct info from the DB…but it doesn’t update.

    Is there a way to get it to refresh automatically?

    Plugin Author Michael Simpson

    (@msimpson)

    @bobkinnison
    CF7ToDBData is not used anymore as I stated in the post before yours. In the refresh code given in this thread, it would seem you would need to change the call to “setValue” to pass in the text for the new function generated from the short code builder page.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘WordPress to Google Drive Spreadsheet, Step-By-Step’ is closed to new replies.