Deleting files after data has been imported from them


#1

Hi

I’m new to Sheetgo. I’ve set up a connection and the import works. However, I would like to remove the files from the Google Drive folder where the data is getting imported from after the import has completed (I have selected a folder rather than a file as the name of the file that lands in the folder will be slightly different each day). Is this possible?

If not then each day I will end up with more and more duplicates in my Google Sheet (which is using the append function) as there will be a fresh file imported into the folder each day but the old file will still exist in there too. Therefore the old files will keep getting imported each day along with the new file.

Many thanks,

Martin


#2

Replying to myself here:

If the deletion is not possible then perhaps adding a date string to my query would help? Essentially I would want to select the data from columns B, C, E, F, I but only when the date in column B is yesterdays date. For information (don’t know if this is important) the date shows formatted as 05 Mar 2019 08:14:19 when I open the CSV file in Notepad.

I have no idea how to write this query. Would it be something like the following?

SELECT B, C, E, F, I WHERE toDate(B) = toDate(now(), -1)

Thanks

Martin


#3

Replying to myself again:

The above doesn’t work but it might work as a solution if I could write the query correctly? Anyone have any suggestions?

Thanks

Martin


#4

@eugenia isn’t this exactly what you have composed for Jeff? :thinking:


#5

Hi @Atlas

The best way to do this would actually be to upload the new files over the old ones, using google versioning. You know how google offers to keep the file as a new version of the old one, or a separate one?
Do take a look at this video I made for another user to solve a similar problem.

@Bobby its slightly different.


Only append new data?
#6

Hi Eugenia

Thank you for your suggestion. I can see how to add versioning but I’m not sure if it works with the following scenarios?

  1. My file is uploaded automatically everyday via a Zapier script
  2. My file will be named slightly differently everyday (there is a prefix which is the same each day but then followed by a date and time string)

Is versioning able to work in such scenarios?

Thanks

Martin


#7

Hi Martin (@Atlas)

Gimme sometime to research, but my guess is it should. On my previous experiences versioning was mostly related to metada. I’m gonna do some research on your particular case.
Could you let me know what’s the origin of the file being uploaded by zappier?

Kind regards


#8

@Atlas
Here’s what I got.

And I’ve never set up anything with zappier before, but you can choose to use the “replace a file” instead.
And it will prompt you to select a file to replace:


You can choose the previously used file (check the file id on light gray)
And this should solve your issue.
Note, the file name will still change, but for google drive’s purposes it will still be the same file. You can see it says its a .txt but as the previous file was actually a google sheet, when I look at it on my drive, I can still see it as a google sheet, since metadata was preserved.

let me know when you get a chance to try it.


#9

@eugenia that’s pretty cool. Thanks for your help! :yum:


#10

That’s great, thanks so much for investigating Eugenia. I’ll put that in place.

Many thanks

Martin