2

Just wondering if this was possible?

Every day new files are added to a Google drive folder by a user, these are then imported in a sheet manually. Is it possible as soon as the info is in the folder for it to automatically import it into the sheet in the same fashion?

Ritesh Nair
  • 3,327
  • 1
  • 17
  • 24
Mike K
  • 89
  • 2
  • 2
  • 7

1 Answers1

2

EDIT: I saw that Cooper wrote it in the comments so credits to him.

You can't make a trigger based on a new document coming in the folder. However, you could set a time trigger to check every hour or every 30 minutes if there is a new folder and if yes have it imported in the spreadsheet. This is the simplest way to do it.

enter image description here

Hope this helps!

Taum
  • 321
  • 2
  • 19
  • Thanks great help.. So to clarify in gas there is a method to import that you can script ? And to make it a work, check the folder using a timer, when it finds a new file has been added run a script to pull it in, correct ? Thanks – Mike K Aug 10 '17 at 08:45
  • @MikeK what type of files are you trying to import into a spreadsheet? And yes you can set your script to activate every x-amount of time and check for new files, if there are any it will run the rest of your script, allowing you to have this happen automatically – Taum Aug 10 '17 at 09:05
  • the files come in as excel files, which I normally import in manually before running other scripts just be more efficient to automate the process. The files names always start with report followed by numbers.. thanks for your help so far – Mike K Aug 11 '17 at 15:12
  • 1
    @MikeK Then yes you can do this, here is a **[link](https://gist.github.com/azadisaryev/ab57e95096203edc2741)** to a basic script to use to import excel files to google spreadsheets. You can use it as a base for your own code, if you struggle with any part of the code you can ask another question on the site with the part you need help with. Good luck & hope this helps you! – Taum Aug 14 '17 at 00:49
  • 1
    @MikeK this **[link](https://stackoverflow.com/questions/26854563/how-to-automatically-import-data-from-uploaded-csv-or-xls-file-into-google-sheet?rq=1)** should also help you – Taum Aug 14 '17 at 00:53