Search code examples
google-apps-scriptgoogle-sheetstimestampgoogle-forms

IMPORTRANGE timestamp import filter


I'm looking to have a form, which I expect will be used continuously over the next few quarters. I'm trying to create bi-weekly reports (in the form of new spreadsheets) that I can send out and keep records of.

This is as far as I've reached. The idea is that it will:

  1. Import column D
  2. If the person who submitted the form is Joe (column E) - I can make it work up to here.
  3. If it is between two dates (this is where I am unsure of what to do)

    =filter(IMPORTRANGE("ExampleSheetURL", "Form Responses 1!D2:D30"),INDEX(IMPORTRANGE("ExampleSheetURL", "Form Responses 1!E2:E30"))="Joe",DATEVALUE(IMPORTRANGE("ExampleSheetURL", "Form Responses 1!A2:A30")>=DATEVALUE(TODAY())))
    

I need a way to import the timestamp and then convert it to a format that I can filter with.

This formula does not work and I've hit a mental roadblock, I'm hoping someone out there might have some ideas.


Solution

  • I think I may have found the answer to my own question, but if someone would like to check it, I wouldn't be opposed:

    =filter(IMPORTRANGE("ExampleSheetURL", "Form Responses 1!D2:D30"),INDEX(IMPORTRANGE("ExampleSheetURL", "Form Responses 1!E2:E30"))="Joe",INDEX(IMPORTRANGE("ExampleSheetURL", "Form Responses 1!A2:A30"))>DATEVALUE("04/25/2015 24:59:59"),INDEX(IMPORTRANGE("ExampleSheetURL", "Form Responses 1!A2:A30"))

    I thought when importing the timestamp, I would need to import it using DATEVALUE, but it looks like using INDEX works for what I'm trying to accomplish here. I noticed that if I just set the date value without hours/minutes, it would count noon on the 27th as being > the 27th on it's own.

    Rock on my friends.