How to Automatically Share on Google Drive With Google Apps Script

Поділитися
Вставка
  • Опубліковано 23 лис 2024

КОМЕНТАРІ • 65

  • @DigitalInsidersShop
    @DigitalInsidersShop 3 місяці тому

    Very helpful! Thank you so much!

  • @harithrani5929
    @harithrani5929 2 роки тому

    Very neat. The teaching style is precious. Lovin it.

    • @saperis
      @saperis  2 роки тому

      Thank you! 😊

  • @canadasmartmind
    @canadasmartmind 2 роки тому

    Thanks ! This is what I've been looking for. Thank you!
    Great video. Keep flowing your word.

    • @saperis
      @saperis  2 роки тому +1

      Happy to hear this video was useful!

    • @canadasmartmind
      @canadasmartmind 2 роки тому

      Hi Jane. Thanks a lot. this video solves my problem. I have no experience whatsoever in scrips. I just code it now and works fine. Awesome!

  • @DevLearn-lv7nr
    @DevLearn-lv7nr Місяць тому

    hi in line 7 what is the relevance of the keyword "function" which (if it is a unnamed function) is being fed the array name - can you not refer to the array itself why pass it as a parameter to "function" ?

  • @TMCI-education
    @TMCI-education 10 місяців тому

    Your work is amazing! In building upon the tutorial, is there a way to use Google Forms so people can submit their email on google forms, saved to google sheet, then allow them to automatically have access to a specific file, which you have set?

    • @saperis
      @saperis  10 місяців тому

      Yes, you can create an Apps Script project to do that.

  • @RahulGupta-bn4rj
    @RahulGupta-bn4rj Рік тому

    excellent video, it would help , i request you to make videos on some more advance functionality with google app script

    • @saperis
      @saperis  Рік тому

      I don't make any Apps Script videos on this channel anymore.

  • @hindont
    @hindont Рік тому

    Great video. What if I want to share a folder?

    • @saperis
      @saperis  Рік тому

      If you want to share a folder I suggest you check the documentation. Like that you'll find out how you can share a folder: developers.google.com/apps-script/reference/drive/folder

  • @doslayouts
    @doslayouts Місяць тому

    Hello! How do I stop sending the file again from previous people whenever I send the file to new people?

  • @AmmarMerhbi77
    @AmmarMerhbi77 2 роки тому

    Great video. What if one wants to share one file with multiple emails. Can it be customized for comma separated emails?
    What about unsharing?

    • @saperis
      @saperis  2 роки тому

      Yeah, I guess you could adapt the code as to have all emails in an array and then probably use REGEX to identify the separate email addresses. REGEX is not my forte so I personally wouldn't want to use that method.
      There are methods for removing access to files. Check here: developers.google.com/apps-script/reference/drive/file#removeEditor(String)

  • @EderRamosHenriquez
    @EderRamosHenriquez 3 місяці тому

    Can somebody confirm if there any way to not send the notification via email when we share the file via script?

  • @anthonyescribens
    @anthonyescribens 2 роки тому

    Awesome! Thank you.

    • @saperis
      @saperis  2 роки тому

      You're welcome! 😀

  • @nnekao6563
    @nnekao6563 2 роки тому

    Very helpful video. Question for you: When sharing can you also add a custom message?

    • @saperis
      @saperis  2 роки тому

      The methods to set permissions don't accept a message. You would have to expand the script to send those people a message through Gmail.

  • @Leover378
    @Leover378 2 роки тому

    Muy buen video. Nuevo suscriptor.

    • @saperis
      @saperis  2 роки тому

      Gracias! Me alegra que te ha gustado este video. Tenemos muchos otro videos para aprender Google Apps Script.

  • @aliciachin5260
    @aliciachin5260 Рік тому +1

    What's the reason for using const instead of var in this case?

    • @saperis
      @saperis  Рік тому

      Check this video to see the difference between const and var: ua-cam.com/video/x3xZXJmb05U/v-deo.html

  • @SecurityBytes-w7e
    @SecurityBytes-w7e 5 місяців тому

    hello i want to put message in it too! how i can do it??

  • @ArkadiaTube
    @ArkadiaTube 2 роки тому

    Can we run a zap to automatically run the script? I have Kajabi course that grants access to a spreadsheet to the person that purchases the course (currently adding students to the sheet manually - trying to learn how to automate this process). So I can create a zap (when student signs up in Kajabi, add data to “sharing automation” spreadsheet). I’d like to use a zap to also automatically run the script once new data is added to the “sharing automation” spreadsheet. So if someone signs up for the course in the middle of the night, I don’t need to go click a button to share the file with them.
    Thank you! Appreciate any insights you can offer!

    • @saperis
      @saperis  2 роки тому

      I'm assuming you are referring to using Zapier to automate the process. I know you can automate lots with Zapier, have never done so myself though.

    • @psalm1.0
      @psalm1.0 7 місяців тому

      Did you figure this out? I have pretty much the exact same issue as you

  • @ruangbelajarkuclub
    @ruangbelajarkuclub Рік тому

    Thanks for explain this video.. can you make video share automate file to whatsapp using google appscript. Thanks before

    • @saperis
      @saperis  Рік тому +1

      We do not do any Apps Script videos on this channel anymore.

  • @InspireForex
    @InspireForex 2 роки тому

    This is an amazing Video. I really needed very much this script. Now I am only stacked in two steps.
    1- is an error related to emailAndPermissions.forEach ... It says it is not a function. I changed it to array.from(emailAndPermissions).forEach and it seems to work but
    2- When I run the script it continues to give me the Alert message " Permissions must be.... etc, etc" in the sheet. It seems like a loop. Every time I click 'ok' it reappears.
    Can you please help?

    • @saperis
      @saperis  2 роки тому +1

      I would suggest you stick to the script I wrote. The error message about the permissions is trying to tell you that you are using the method and passing in the correct parameters.

    • @InspireForex
      @InspireForex 2 роки тому

      Saperis, I saw another user had my same problem. email.AndPermissions.forEach is not a function. You said to him to check the variable name. It is not about the name.
      As I said I needed this script so I went over and over at lesst 50 times.
      It doesnt work for me and apparently for this other user.
      So, if you want to help, ok, otherwise no problem. I will find a solition

  • @ConanEdogawa24710
    @ConanEdogawa24710 2 роки тому

    Hi I like how you explain things in your videos. Can you make a video about PMT function? I have a hard time understanding that function Please and Thank You!.

    • @saperis
      @saperis  2 роки тому

      What's a 'PMT function'?

    • @ConanEdogawa24710
      @ConanEdogawa24710 2 роки тому

      @@saperis
      Well, all I understand from it is that, its helpful when you are buying a house or a car. The formula is =PMT (rate, number_of_ periods, present_value, future_value).

    • @saperis
      @saperis  2 роки тому

      @@ConanEdogawa24710 Well, I have no clue of that PMT formula so I better stick to making videos about things I have knowledge about: Google Workspace and Google Apps Script. 😀

  • @ralphjosephmarifrilles1604
    @ralphjosephmarifrilles1604 Рік тому

    Hi Saperis good day! It is posible to print a pdf file on google drive using apps script.

    • @saperis
      @saperis  Рік тому

      No, you can't print a PDF. But you can export a file and save to Google Drive as a PDF: ua-cam.com/video/xUovS4fwqsg/v-deo.html

  • @DiệnTrầnQuang-e1r
    @DiệnTrầnQuang-e1r Рік тому

    Your video is very helpful. But I don't want to send the file sharing notification to these objects. Can you guide me?

    • @saperis
      @saperis  Рік тому

      Are you sure a notification is sent? The documentation doesn't mention anything about a notification being sent: developers.google.com/apps-script/reference/drive/file#addvieweremailaddress

    • @DiệnTrầnQuang-e1r
      @DiệnTrầnQuang-e1r Рік тому

      @@saperis No. don't want to send notifications to the person being shared.
      Because by default of google driver, if I add any person with any permissions, Driver will send a message to the shared person.

  • @canadasmartmind
    @canadasmartmind 2 роки тому

    Hi Jane. Is it possible to automatically, via code, not send a Notification to the person I share my Google doc with?
    I have successfully used your code shown in this video.
    Thank you, Saperis.

    • @saperis
      @saperis  2 роки тому +1

      The script in this tutorial doesn't send out any notifications to the person you are sharing the file with.

    • @canadasmartmind
      @canadasmartmind 2 роки тому

      @@saperis Ok, Helen.
      Thanks!

    • @dyobetem
      @dyobetem 2 роки тому

      actually it sends a notification on their end.

    • @luffyheng4783
      @luffyheng4783 2 роки тому +1

      @saperis it does send out notification, how do we disable that?

  • @nathanham1636
    @nathanham1636 Рік тому +1

    Hi, how can I have this script run automatically whenever a new entry is added? I don't want to click it every time :)

    • @saperis
      @saperis  Рік тому

      You have to add a onEdit trigger. Find out more about triggers: ua-cam.com/video/KC7pBjD3GGw/v-deo.html

  • @livinglife7049
    @livinglife7049 2 роки тому

    Hello ik this is totally unrelated but one quick question: I am currently trying to get some photos from my phone but it's damaged is there a way that I could sign into my original account on either Google photos or Google files to get them back?

    • @saperis
      @saperis  2 роки тому +1

      Sorry, we don't use Google Photos at all. So we have no clue if this is possible. ☹

    • @livinglife7049
      @livinglife7049 2 роки тому

      @@saperis Ok thanks for the info

  • @justsurfin5013
    @justsurfin5013 2 роки тому

    Question, what if you have more than one FileID in column A? I tried this and it only did one file and ignored the remainder. I saw that the ForEach loop was just for the permissions list but there was no loop for the fileID list? Tried to figure it out but beyond me.

    • @saperis
      @saperis  2 роки тому

      Correct, my script only expects one file ID.
      You would have to create adapt the script quite a bit to make it get n-amounts of file IDs and then loop over them.

    • @justsurfin5013
      @justsurfin5013 2 роки тому

      @@saperis And you just fed my OCD a pet-project :) I can see where this would be useful for permission templates. Thanks for giving me something to chew on.

    • @danielkwok6460
      @danielkwok6460 2 роки тому

      @@justsurfin5013 did you ever figure out how to do this?

    • @KhanhNguyen-yq5is
      @KhanhNguyen-yq5is 2 роки тому

      @@saperis Thanks for your great tool. It just save me a lot of time adding ppl in the file. Anyways, I need to share mutiple files (more than 1 ID) to different ppl, do you have any idea on how to adjust the script. Thank you

    • @saperis
      @saperis  2 роки тому

      @@KhanhNguyen-yq5is You could change the script so that it gets all the values in the file ID column and then iterates over them.

  • @htablet6424
    @htablet6424 2 роки тому

    Great video,
    I want one file one email, 2nd file 2nd email
    Give idia

    • @saperis
      @saperis  2 роки тому

      Whenever you want to create a new script you check the documentation. What methods exist? How can you use them?
      See here: developers.google.com/apps-script/reference

  • @arshanurag5658
    @arshanurag5658 2 роки тому

    Hey one doubt... Why I'm getting "TypeError: emaiAndPermissions.forEach is not a function".

    • @saperis
      @saperis  2 роки тому

      I'm guessing you have a typo in your code. Did you really name your variable 'emaiAndPermissions'? Or is it 'emailAndPermissions'?