• Resolved 1jd123

    (@1jd123)


    Dear all,

    I really love the export function but I ran into a major problem.
    Every data is exported perfectly fine, but without timestamps. I Tried to add timestamps via google sheets script, but it only works when the data is manually added not when the data is send by forminator automatically. Can you please help me with this?

     /** @OnlyCurrentDoc */
    function onEdit(e){
    const sh = e.source.getActiveSheet();
    sh.getRange ('M' + e.range.rowStart)
    .setValue (new Date())
    .setNumberFormat ('MM/dd/yyyy HH:MMam/pm');
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @1jd123,

    Just to be sure, instead of using a custom code, could we know if you tried the inbuilt feature within the “Hidden” Field?

    You should be able to add “Submission Time” via the Hidden field, which should get added to the Google Sheets export as an extra field.

    The above would be an easy workaround; could you please let us know whether that helps?

    Screenshot:

    Screenshot at 16:13:12.png

    Looking forward to your response so that we can assist further if needed.

    Kind Regards,
    Nithin

    Thread Starter 1jd123

    (@1jd123)

    Hey Nithin,

    thank you so much this will work for me. Is there any possibility to change the data format for time to hh:mm and not HH:MM am pm?

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @1jd123,

    Please change the format of the time picker to 24 hours, I hope that helps.

    https://ibb.co/L5WFTWw

    I hope that helps.

    Kind Regards,
    Nebu John

    Thread Starter 1jd123

    (@1jd123)

    Hey Nebu,

    thanks for your reply but i am using a hidden field which only offers me one setting for date and time which is hh:mm:ssAM/PM there is no option to change this

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @1jd123

    I think we can modify this solution a bit so you could modify the time format.

    First thing to do would be to edit the hidden field on the form and change its setting of “Default Value (optional)” from current setting to “Custom Value” option and then put this in “Custom Value” field:

    mytime

    and save the form.

    Then you would add this code to the site as an Must Use plugin:

    – create an empty file with a php extension (e.g. “forminator-hidden-time-format.php”)
    – copy and paste this code into it

    <?php 
    
    add_filter( 'forminator_field_hidden_field_value', 'forminator_hidden_time_format', 10, 2 );
    function forminator_hidden_time_format( $value, $saved_value ) {
    	
    	if (( $saved_value == "custom_value" ) && ($value == "mytime")) {
    		
    		
    		// uncomment 1st $format line below to automatically get the time format as set in WP
    		// or the 2nd $format line to set your own format (use same format as for php date() function
    		
    		//$format = get_option('time_format'); 
    		//$format = 'H-m-s';
    		
    		
    		$value = date_i18n( $format, current_time('timestamp'));
    	
    	}
    	
    	return $value;
    	
    }

    – uncomment one of these lines, depending on whether you want to use time format set in your site’s settings or some custom format

    //$format = get_option('time_format'); 
    //$format = 'H-m-s';

    – save the file and upload it to the “/wp-content/mu-plugins” folder of your site’s WP installation

    Best regards,
    Adam

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @1jd123 ,

    We haven’t heard from you for over a week now, so it looks like you don’t need our assistance anymore.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Google Sheets Export’ is closed to new replies.