Forum Discussion

MiguelFrancis3's avatar
MiguelFrancis3
Qrew Member
2 years ago

Moving Files to a Google Folder and Subfolder

Hi All,

I want to start storing the file attachments on a google drive, the way that I want to structure this is I want to create a Pipeline that everytime a new record is created with an <address> this address will be the name of a folder on my google drive, and then every time that a file is attached to a particular field the file will be move to that folder, the name of the file will be the <address>+<field name>+<filename>

Do we know if Pipelines supports this? 

Thanks in advance,








  • Sure - there is an action to Create a Folder in Google Drive via Pipelines and then another action to upload a file to Drive. 

    In your case - you would want to create the trigger when a new record is created to then create the Folder - at which point you then want to store the Drive ID back in Quickbase in that record. You will need this when you then upload files to make sure you upload to this particular folder without having to do additional searches. 

    Then you would have Pipeline(s) to upload the file to the stored Drive Folder ID from above when a new file is attached. 

    From your description it sounds a little like you might have several file attachment fields in your record - I might recommend making a 'Documents' table as a child to your main record so you can upload as many attachments as you need. This also allows you to make 1 pipeline bound to the Documents record. However if you keep with having multiple file attachments in the same record - there are a couple ways you could handle it with IF conditions in your pipeline but for simplicity I would suggest setting up a different pipeline for EACH file attachment, triggered whenever a file is uploaded to that field as the trigger. 



    ------------------------------
    Chayce Duncan
    ------------------------------
  • I agree with Chayce's approach. One word of caution from recent experience is that the system might not recognize the new folder being created for 10-15 minutes. I was using Box instead of Google Drive, but I imagine the refresh rates are similar across the systems. I spent hours trying to figure out why my Pipeline kept saying the folder I just created didn't exist until I finally realized it was a timing issue.

    I'd suggest keeping your folder creation and document upload Pipelines separate and running your folder creation one well in advance to ensure it sees the new folders where the documents are to be uploaded. This can be frustrating from a user perspective though, so I'd love to hear if anyone has found a way around the delay.



    ------------------------------
    Oana Whalen
    ------------------------------
    • ChayceDuncan's avatar
      ChayceDuncan
      Qrew Captain

      In reference to Oana's point - for sure they will need to be separate pipelines. One remedy to the above is to have a Pipeline that is triggered on new files being updated and then a batch job Pipeline that does a sweep nightly for anything that might have failed. This would cover any latency where Google doesn't recognize the file as well as any other errors that might occur naturally as errors do. This would include just running through all the files where the Folder ID is populated but the file hasn't been processed. As part of this - I would recommend when you upload a file you tag that actual file with the Google File ID so you can build a URL to the Google Drive location as well as know it was processed. 



      ------------------------------
      Chayce Duncan
      ------------------------------
  • BrianSeymour's avatar
    BrianSeymour
    Qrew Assistant Captain

    Hey Miguel, as Chayce mentioned, one technique is to leverage Quickbase's Google Drive Pipelines Channel to create the Drive Folder and then write the Folder ID back to your Quickbase app once it's been created. I've set this up in the past where we create a new record in a QB "Links" table which relates back a parent record (e.g. Project). This allows us to create a nested directory structure, where one Drive Folder may have subfolders too.

    When creating the Drive folder record, I also append the QB Record ID to the Folder name to help with searching via Drive. And in Quickbase you may use a Formula URL to construct a link to Google Drive folder by basically concatenating the base path to Google Drive with the stored Links ID. That way users can click a button on a QB Form or Report to easily get to the right location in Google Drive.

    Also, users can upload files directly to Google Drive, which is different than what you're asking, but it may be an alternative to consider. There are pros and cons to consider, especially with data validation.



    ------------------------------
    Brian Seymour
    ------------------------------
  • Hi Miguel, I agree to Oana's point regarding the delay with box google drive channel is pretty fast and I have configured it in the past but still giving it a minute or two time delay using the clock channel helps. Also, when you are using the address field in the naming convention you will have problem with that. Underscore (_) would be missing when you pull the native address fields so be cautious with that. 



    ------------------------------
    Srinath M.R
    ------------------------------
    • MiguelFrancis3's avatar
      MiguelFrancis3
      Qrew Member

      Hi All,

      Thanks for all your feedback and recommendations... I will start working on it, I am not familiar with all that was recommended here so I might come back with some questions :) 

      Thanks again to All!

      M



      ------------------------------
      Miguel Francis
      ------------------------------