Search API Connector Documentation

Print

Print Timestamp in Response

The API Connector add-on for Google Sheets provides an option to include a timestamp in your sheet each time your data refreshes. To access, click on the ‘Output options’ button and check the ‘Add timestamp’ box.

add-timestamp-img1

CONTENTS

BEFORE YOU BEGIN

If you haven’t already, click here to install the API Connector add-on from the Google Marketplace.

OVERVIEW

If you choose to add a timestamp, the timestamp of each data refresh will appear in the first column (column A) of the data output. This will shift all response data over by 1 column, so, if you are appending to existing data, insert a column first to accommodate the new timestamp. In overwrite mode, the refresh timestamp will always be printed into the first row of data after the headers, while in append mode, it will print into the first empty row.

add-timestamp-img2
Timestamps can be added to any request, whether scheduled or manually refreshed.

EACH ROW OPTION

By default, the timestamp will be printed at the start of the data set. If you prefer to see the timestamp on every row, click the “Each row?” option to enable it.

TIMEZONE & LOCALE

Timestamps will use the timezone of the sheet, which can be viewed by clicking File > Spreadsheet settings. They will match the default format of your locale (also viewable in your spreadsheet settings), though you can change this via date formatting options.

TROUBLESHOOTING

If you are running a scheduled refresh, and notice missing or delayed timestamps, please consult the “Troubleshooting Triggers” section of the Scheduling article.

3 thoughts on “Print Timestamp in Response”

  1. Currently timestamp is added only into the first row of imported data.

    If someone needs to put timestamp into each data row, i.e. to plot them:

    1. Add the following script to your GSheet:

    function fillMyRow() {

    const ss = SpreadsheetApp.getActive();
    const sh = ss.getSheetByName('Sheet1');

    const values = sh.getRange('A2:A'+sh.getLastRow()).getValues().flat([1]);

    var toCopy;
    values.forEach((el,index)=>{
    if (el != ''){
    toCopy = sh.getRange(index+2,1).getValue();
    } else {
    sh.getRange(index+2,1).setValue(toCopy)
    }
    })
    }

    2. Run this script through time-based trigger, so you get everyday consistent timestamps for your data.

    Reply

Leave a Comment