If you are using the Google Sheets add-on to send submissions to a sheet, you may want to include a date or timestamp with each entry. This helps with tracking, filtering, and reporting on form activity directly in your spreadsheet.
WS Form makes this easy using variables. You can add a submission date to your Google Sheet without needing to add any extra fields to your WordPress form.
Follow these steps to learn how:
Add a Submission Date Column in Google Sheets
Start by opening the Google Sheet connected to your form. Add a new column where you want the submission date or timestamp to appear. For example, name the column Submission Date. This will be the target column for your form data.
Configure a Custom Mapping in WS Form
In WordPress, open your form in the WS Form layout editor and then following these steps:
- Click the Actions icon at the top of the layout editor. The Actions sidebar will open.
- Open the existing Add to Google Sheets action (or create a new one).
- In the Custom Mapping setting, click the Refresh icon,
- Click the Add icon to add a custom mapping row.
- In the Meta Value column, insert the current date by using the following variable:
#blog_date
- In the Google Sheets Column column, choose the Submission Date column.
- In the Format column, choose Date.
- In the Meta Value column, insert the current date by using the following variable:
- Click Save & Close.
- Publish the form if necessary.
Test the Form
Now test your form and the Submission Date column in your Google Sheet should now contain a date when a new submission is submitted.
Alternative Date / Time Formats
To insert the current date and time in a custom format, you can use #blog_date_custom
, for example:
#blog_date_custom("m/d/Y H:i:s")
If you choose a format containing a date and time you should choose Date/Time for the Format.
Date formatting in WS Form follows the same conventions used when formatting PHP dates. For a list of available formatting string options, see the PHP date manual page.
Other variables that can be used in custom mapping are as follows:
#blog_date_custom("formatting string")
#post_date_custom("formatting string")
#server_date_custom("formatting string")
For example:
#server_date_custom("m/d/Y H:i:s")
These dynamic variables are processed at the time the form is submitted, so your date or timestamp will always reflect the exact submission time.