Open muffaddal opened 5 years ago
Hi,
You should be able to use the copy
method Laravel provides (I think).
Storage::cloud()->copy($original, $duplicate);
The problem is that it will need the original's file ID, not the actual filename. Same goes for any subdirectories of the duplicate filename/path.
Code on how to get the ID is already in the examples.
Hope this helps...
Thanks Ivan for the prompt response! However i achieved this by creating a new instance of Google_Service_Drive_DriveFile
$fileToCopy = new \Google_Service_Drive_DriveFile('fileId');
$fileToCopy->setName('filename');
$file = $service->files->copy($template->basename, $fileToCopy);
This is off topic, but do you have any idea on how to open the google doc in edit mode in an iframe, from your web app?
Ok, cool! I've been wanting to learn more about the underlying Google API ad perhaps create a more advanced wrapper around it, but at the moment I still can't prioritize it unfortunately. It's still on my things-to-explore list though.
For the embed editor, this worked for me: https://community.spiceworks.com/how_to/133689-how-to-embed-an-editable-google-docs-sheet
You create a share link that anyone with the link may edit the doc, and then you put it in an iframe. Downside is, anyone with the link can edit... which may not be secure enough?
I haven't found any other approach. Only read-only embed codes.
Hi can you upload a sample code to check how to create a copy of a file?