Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Update Relative Links when Copying Files #1

Open
ghost opened this issue Mar 19, 2022 · 1 comment
Open

Feature Request - Update Relative Links when Copying Files #1

ghost opened this issue Mar 19, 2022 · 1 comment
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@ghost
Copy link

ghost commented Mar 19, 2022

Background

TLDR; what you've created is 80% of what I'm looking for, very cool!

As you described, I'd like to create a "project template" directory with a handful of files and folders that I can copy and use for future projects. The one challenge I have is that I'd very much like to include and maintain links between documents.

For example, in my template folder, the project plan Google Doc might link to the project status Google Sheet. If I were to copy the entire folder, my understanding is that the copied project plan would have a link pointing to the old project status.

Google Drive objects (slides, docs, etc.) seem to use a unique ID that stays persistent regardless of the document name, and I haven't found an out-of-the-box way of using relative links the way we would do on linux shell or HTML.

I haven't worked with AppScript or Drive APIs, but if Google doesn't have a native API to find a document by path (sort of how S3 or GCS would work), then I think this would be a pretty tedious exercise (esp. since I'd want support for Sheets, Docs, and probably Slides).

But doesn't hurt to share the idea, I suppose :)

@usaussie
Copy link
Owner

Yeah -- so this would be an added layer of complexity, because effectively what you need to do is insert the link to the dynamically created document/sheet, into each dynamically created doc/sheet. It's not impossible of course, but just will take a little more complexity and would need to be a separate solution than this (as it's a slightly different use case).

The loop would need to look something like this (i think, off the top of my head):

  1. The main control google sheet will need a couple more columns, to store the template Sheet AND the template Document
  2. Find the template doc and sheet, copy them, and place into the new target folder
  3. Store the ID of the document and sheet created in step 2
  4. Using the Docs API, open the newly created document (from step 2) and insert a link to the newly created Sheet from step 2 (using the ID that was stored/noted in step 3).
  5. Finish the loop and clear the memory/references, and continue onto the next entry

So....definitely possible, but not what i would put inside this particular appscript project. Mainly because the premise is somewhat that the newly created folder will be shared with the necessary people, and it's super easy for them to just look for the google sheet/doc in that same folder.

@usaussie usaussie added enhancement New feature or request wontfix This will not be worked on labels Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant