How to Automatically Share on Google Drive With Google Apps Script

Поделиться
HTML-код
  • Опубликовано: 28 ноя 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! 😊

  • @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.

  • @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!

  • @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: ruclips.net/video/x3xZXJmb05U/видео.html

  • @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.

  • @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?

  • @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! 😀

  • @SecurityBytes-w7e
    @SecurityBytes-w7e 5 месяцев назад

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

  • @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)

  • @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.

  • @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: ruclips.net/video/xUovS4fwqsg/видео.html

  • @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.

  • @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.

  • @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

  • @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

  • @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?

  • @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.

  • @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

  • @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: ruclips.net/video/KC7pBjD3GGw/видео.html

  • @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. 😀

  • @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'?