I query Google Analytics API from outta Google Sheets.
My endDate I define in B2 as =today(), my startDate I define in B3 as =B2-30.
B2 and B3 cells I formatted manually as date in yyyy-mm-dd format.
On running a query I get an error:
{ "error": { "code": 400, "message": "Invalid Date specified: Wed Oct 27 2021 00:00:00 GMT+0200 (CEST)", "status": "INVALID_ARGUMENT" } }
What is wrong with my date input?
I have one guess, my dates from B2 and B3 are transmitted to API instead of format mm/dd/yyyy in the format Wed Oct 27 2021 00:00:00 GMT+0200 (CEST). If my guess is correct, how can I turn dates into the right format?
To use dates coming from formula like =today() and derivative calculations it doesn't help to re-format values as dates manually, using GSheets formatting function, as I tried it before.
The way I worked it successfully out, is to explicitly make a text from values while formatting it to the needs, like it explained in the according documentation:
=TEXT(TODAY(),"yyyy-mm-dd") and =TEXT(B2-30,"yyyy-mm-dd")
Related
Function which isn't working: =QUERY(A:B, "SELECT A WHERE B > " & D1, 0)
What it's looking at:
A
B
Strings
13 Feb 2023
Strings
18 Feb 2023
Strings
21 Feb 2023
Cell D1 =
10 Feb 2023
Trouble shooting:
The query is coming up no results. All dates are numbers, when I format them as numbers instead of dates it works, when I format them as DD MMM, it works, but when I format them as DD MMM YYYY it doesn't work and this is the format I need it in.
Question
Why is Query so sensitive to date formats?? I always use different date formats depending on the sheet and vlookup has no issue with this. Also why on earth would it just not accept one format? I really want to learn for future
for query you may use:
=QUERY(A:B, "SELECT A WHERE B > date'"&text(D1,"yyyy-mm-dd")&"'")
if you wish to avoid the query confusion; you may just go with simple filter Fx
=filter(A:A,B:B>D1)
I have a column with dates and time formatted like this in each cell:
Thursday, Jan 21, 2021 4:30 PM-5:00 PM
I want to split this across two columns so that the first column has "DD/MM/YY" and the second has the timeslot.
So it would go from being a cell with:
Thursday, Jan 21, 2021 4:30 PM-5:00 PM
to two cells:
21/01/21 4:30 PM-5:00 PM
What formula can I use in Google Sheets to achieve this?
Another suggestion (which assumes here that your raw data runs A2:A):
=ArrayFormula(IF(A2:A="",,SPLIT(REGEXREPLACE(A2:A,"^\w+, (.+\d) (\d.+$)","$1~$2"),"~")))
This will leave your dates in the first column as numeric raw dates rather than as text, so you'd be able to use them in calculations and comparisons later. Just select the first column of the results (i.e., those raw dates, showing as numbers in th 40000 range) and format the entire column (Format > Number) in the date format you prefer.
use:
=INDEX(IFNA(TEXT({REGEXEXTRACT(A1:A, ", (.+\d{4})")*1,
REGEXEXTRACT(A1:A, "\d{4} (.+)")}, {"dd/mm/yyyy", "#"})))
I'm using Zapier to input timestamps of emails to Google Sheets. The format I'm seeing in Google Sheets is:
Wed, 28 Jun 2017 21:02:51 +0000 (UTC)
Is there a way to either change this (in Google Sheets) to 2017-06-28 21:02:51 or to help date-related functions to understand this format?
You should be able to extract date from string:
=DATEVALUE(REGEXEXTRACT("Wed, 28 Jun 2017 21:02:51 +0000 (UTC)","\d+ [A-Za-z]{3} \d{4}"))
REGEXEXTRACT part extracts "28 Jun 2017". Then format the result as date.
Edit:
Getting closer :) Error DATEVALUE parameter '28 Jun 2017' cannot be
parsed to date/time.
I think this is bacause of your regional settings.
Option: writing script, my solution wont work.
Option: Change File → Regional Settings to US.
Option: modify the formula so it replaces english names of monthes into their numbers. This would produce ugly big formula.
I am reading list of Google Sheet cells containing DateTime, using Google Apps Script.
The values in the cells are:
A1: Jul 26 13:00
A2: Jul 27 0:00
var dateValues = SpreadsheetApp.getActiveSheet().getRange("A1:A2").getValues();
However, values read are 1 hour behind. This is what I see in the debugger:
dateValues[0] = Wed Jul 26 2017 12:00:00 GMT+0200 (EET)
dateValues[1] = Wed Jul 26 2017 23:00:00 GMT+0200 (EET)
I guess this is a time zone issue, but I don't really understand the concept.
My time zone is currently (due to DTS) GMT + 3. Indeed, outside the DTS period it is GMT +2. The spread sheet time zone is Jerusalem GMT+2.
EET - don't underrated why it is being used.
Basically, I would expect to get in code the values with in the sheet.
What is the concept?
there are two ways to solved this
Use getDisplayValues() rather than getValues(). This will force to do some conversions, as getDisplayValues() returns strings not dates
make you script editor time zone match the sheet tz.
In my case the sheet was (GMT+2 Jerusalem), but the script editor was different (GMT+2 Moscow) for some reason.
Setting the script editor TZ, solved the problem.
select * from weather.forecast where woeid in (SELECT woeid FROM geo.placefinder WHERE text="30.7063633,76.7047791" and gflags="R")
I am using the above YQL to fetch the weather conditions for some lat, lng to show in my iOS app. The response has "pubDate":
"pubDate": "Fri, 29 May 2015 8:30 am IST",
"condition": {
"code": "28",
"date": "Fri, 29 May 2015 8:30 am IST",
"temp": "89",
"text": "Mostly Cloudy"
My concern is, will this "pubDate" ever change? I mean at 8:30 am the weather is mostly cloudy may be at 12 noon it won't be. If i access this YQL at 12 Noon the response will be same ??
Also, I have no idea about the "and gflags="R"" part of the query..
As per Yahoo developer docs here.
pubDate The date and time this forecast was posted, in the date
format defined by RFC822 Section 5, for example Mon, 25 Sep 17:25:18
-0700.
lastBuildDate The last time the feed was updated. The format is in
the date format defined by RFC822 Section 5, for example Mon, 25 Sep
17:25:18 -0700.
So, until and unless the backend gets an update of "temperature change" for a particular location, the API will not reflect any change. So that's why "lastBuildDate" is also comes in the json, which specifies when the temperature feed was last updated. So you can't do anything manually to get the temperature of a particular location for current time,
If you try to call this API in different moments during the same day you will see that lastBuildDate is the same date and time of your call.
The problem here is that the date in the condition doesn't change, and after some time the condition itself becomes obsolete, as you can easily verify using yahoo meteo app.