Skip to content

Standalone Google Apps Script #1065

Closed
Closed

Description

@peter-lyons-kehl

Hi Nick,

would it be possible to support "standalone Google Apps Script" files from Google drive, please? Those are server-side javascripts created and run at https://script.google.com.

Google provides limited API to the source of those scripts. They show up at
https://drive.google.com/drive/u/0/search?q=type:script.

To complicate,

  1. each such script ("project") contains of one or more scripts with extension ".gs" (as listed at https://script.google.com).
  2. Those ".gs" scripts don't show up as separate files via Google API. Only the parent ("project") shows up.
  3. Since those scripts don't count towards user's size quota, the parent shows up with size 0.

See also
http://stackoverflow.com/questions/18445863/how-to-download-google-apps-script
https://developers.google.com/apps-script/import-export#export_projects_from_drive

Activity

  1. ncw commented on Jan 24, 2017

    @ncw
    Member

    What does rclone do with them at the moment? (try with the -v flag).

    Is this just a question of adding a mapping for application/vnd.google-apps.script+json exports?

    See: https://github.com/ncw/rclone/blob/master/drive/drive.go#L60

    Not sure about the parent vs the contents - how do you find the names of the contents if you can't see them?

  2. peter-lyons-kehl commented on Jan 27, 2017

    @peter-lyons-kehl
    Author

    ls lists the file (the container). Copying all files (not sure what rclone command it was, rclone docs are confusing) copies it as an empty file, with .desktop file:

    cat PowerMute.desktop
    [Desktop Entry]
    Icon=application-vnd.google-apps.script
    Name=PowerMute
    Type=Link
    URL=https://script.google.com/d/19QeOin6dGLEuScs7TrMwlfsFna-U1vB4ITbVSv-C4-qRq8EoaPnlGUlV/edit?usp=drivesdk

    Copy of the file fails:
    rclone -v copy Gdrive:PowerMute .
    2017/01/27 18:17:41 rclone: Version "v1.35-DEV" starting with parameters ["rclone" "-v" "copy" "Gdrive:PowerMute" "."]
    2017/01/27 18:17:42 Local file system at /home/pkehl/gdrive: Modify window is 1ms
    2017/01/27 18:17:43 Local file system at /home/pkehl/gdrive: Waiting for checks to finish
    2017/01/27 18:17:43 PowerMute: Modification times differ by -169h22m32.373s: 2017-01-24 06:18:02.373 +0000 UTC, 2017-01-17 15:55:30 +1100 AEDT
    2017/01/27 18:17:43 Local file system at /home/pkehl/gdrive: Waiting for transfers to finish
    2017/01/27 18:17:43 PowerMute: Failed to copy: failed to open source object: forbidden to download - check sharing permission

    The error comes from pairCopyOrMove() in sync.go where pair.src.url is an empty string.

    However, I can't trace in LiteIDE before (above) pairCopyOrMove() in sync.go. Where does 'in' channel data come from? Do you know of any free Golang IDEs for debugging please?

  3. ncw commented on Jan 27, 2017

    @ncw
    Member

    Probably what I'd do next is

    rclone -v --dump-bodies copy Gdrive:PowerMute .
    

    Which will dump the http transactions - that should tell you something!

  4. gustavorochakv commented on Feb 6, 2017

    @gustavorochakv

    I've attached the output of a similar request (syncing a folder containing a single App Scripts file, containing two script files and one html file) using -v --dump-bodies
    log.txt

  5. andrekop commented on Feb 27, 2018

    @andrekop

    I would love to have json backups of my apps script files. Wouldn't it be sufficient to just add a mapping for application/vnd.google-apps.script+json (https://developers.google.com/drive/v3/web/manage-downloads)? I haven't tested it lately but the Drive API should pack everything from a project file together in a single json file.

  6. ncw commented on Mar 6, 2018

    @ncw
    Member

    @andreask1 fancy having a go with that and sending a pull request?

  7. added this to the Help Wanted milestone on Aug 30, 2018
  8. B4dM4n commented on Sep 1, 2018

    @B4dM4n
    Collaborator

    There has been progress for this issue:
    #2479 is a work in progress rewrite of the drive documents handling.
    If anyone wants to help testing the new implementation, there is a beta branch containing the changes:
    https://beta.rclone.org/branch/v1.42-162-g6a66967c-drive-documents/

    Keep in mind this is not tested thoroughly yet and therefore be considered experimental.

    Please post any feedback in #2479. Updated releases will also be anounced there.

  9. modified the milestones: Help Wanted, v1.44 on Oct 4, 2018
  10. B4dM4n commented on Oct 4, 2018

    @B4dM4n
    Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions