simon
(Simon Kenyon)
June 20, 2022, 9:27am
1
How do i copy embedded apps scripts from google drive.
This is so I can back up multiple embedded scripts.
Right now I am doing it by hand (cut and paste) but that doesn't really scale.
rclone copies the google sheets quite nicely, but it ignores the embedded javascript.
i have searched for several days in the rclone docs, this forum, stack overflow, reddit, general googling,...
[Note that the URL is script.google.com and not drive.google.com ]
ncw
(Nick Craig-Wood)
June 20, 2022, 10:47am
2
You can export these scripts from Google drive by setting --drive-export-formats json
- this isn't explained properly in the docs so I've fixed them up.
simon
(Simon Kenyon)
June 20, 2022, 1:57pm
3
i have a directory in a drive shared with me.
if i go:
rclone copy gd_test: --include /TestSpreadsheetWithEmbeddedAppsScript ./test --config=rclone.conf -vv
which should copy the spreadsheet from the shared drive to a local test directory; nothing happens.
if i go:
rclone copy gd_test: --include /TestSpreadsheetWithEmbeddedAppsScript.xlsx ./test --config=rclone.conf -vv
then the file is copied, with the .xlsx extension.
if i go:
rclone copy gd_test: --include /TestSpreadsheetWithEmbeddedAppsScript ./test --config=rclone.conf -vv --drive-export-formats=json
it says TestSpreadsheetWithEmbeddedAppsScript.xlsx: Excluded
and nothing gets copied.
i've tried adding the .xlsx and .json extensions to the file and still nothing gets copied.
can you tell me what i am doing wrong?
You'd have to share all the details in the help and support template as that's why we have it. You deleted it all though so it's tough to know as we don't know what version you are running and there's no log file.
simon
(Simon Kenyon)
June 20, 2022, 2:24pm
5
`rclone v1.58.1
os/version: ubuntu 22.04 (64 bit)
os/kernel: 5.15.0-1011-aws (x86_64)
os/type: linux
os/arch: amd64
go/version: go1.17.9
go/linking: static
go/tags: none`
[gd_test] type = drive scope = drive token = <WHATEVER> root_folder_id = <ID>
2022/06/20 14:23:35 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "copy" "gd_test:" "--include" "/TestSpreadsheetWithEmbeddedAppsScript" "./test" "--config=rclone.conf" "-vv" "--drive-export-formats=json"] 2022/06/20 14:23:35 DEBUG : Creating backend with remote "gd_test:" 2022/06/20 14:23:35 DEBUG : Using config file from "/home/ubuntu/rclone.conf" 2022/06/20 14:23:35 DEBUG : gd_test: detected overridden config - adding "{yboF8}" suffix to name 2022/06/20 14:23:35 DEBUG : fs cache: renaming cache item "gd_test:" to be canonical "gd_test{yboF8}:" 2022/06/20 14:23:35 DEBUG : Creating backend with remote "./test" 2022/06/20 14:23:35 DEBUG : fs cache: renaming cache item "./test" to be canonical "/home/ubuntu/test" 2022/06/20 14:23:35 DEBUG : TestSpreadsheetWithEmbeddedAppsScript.xlsx: Excluded 2022/06/20 14:23:35 DEBUG : Script to create backups in this folder.xlsx: Excluded 2022/06/20 14:23:35 DEBUG : Local file system at /home/ubuntu/test: Waiting for checks to finish 2022/06/20 14:23:35 DEBUG : Local file system at /home/ubuntu/test: Waiting for transfers to finish 2022/06/20 14:23:35 INFO : There was nothing to transfer 2022/06/20 14:23:35 INFO : Transferred: 0 B / 0 B, -, 0 B/s, ETA - Elapsed time: 0.5s
You can use three back tics to include something so it parses the output properly.
You have an include for
What doesn't match.
Both would work.
felix@gemini:~$ rclone lsf GD:
Joeisms.docx
RDManager
TestDoc.docx
blah/
hosts
jellyfish-400-mbps-4k-uhd-hevc-10bit.mkv
test/
test.tar
testcopy
felix@gemini:~$ rclone lsf GD: --include jellyfish-400-mbps-4k-uhd-hevc-10bit.mkv
blah/
jellyfish-400-mbps-4k-uhd-hevc-10bit.mkv
test/
felix@gemini:~$ rclone lsf GD: --include /jellyfish-400-mbps-4k-uhd-hevc-10bit.mkv
jellyfish-400-mbps-4k-uhd-hevc-10bit.mkv
With a Google Document.
felix@gemini:~$ rclone lsf GD: --include TestDoc.docx
TestDoc.docx
blah/
test/
felix@gemini:~$ rclone lsf GD: --include /TestDoc.docx
TestDoc.docx
Example of a copy.
felix@gemini:~$ rclone copy -v GD: --include /TestDoc.docx /home/felix/
2022/06/20 10:37:40 INFO : TestDoc.docx: Copied (new)
2022/06/20 10:37:40 INFO : TestDoc.docx: Copied (Rcat, new)
2022/06/20 10:37:40 INFO :
Transferred: 11.938 KiB / 11.938 KiB, 100%, 0 B/s, ETA -
Transferred: 3 / 3, 100%
Elapsed time: 1.3s
I usually test my filters with ls / lsf / lsd first to validate I'm getting what I want before I copy.
simon
(Simon Kenyon)
June 20, 2022, 2:51pm
7
i hate to be ungrateful for your help; but my issue is with enbedded javascript in google drive spreadsheets.
You'd have to articulate how to test what you are talking about with a logfile. The log you shared copied nothing so it's not helpful.
simon
(Simon Kenyon)
June 20, 2022, 3:04pm
9
There are two results:
the file is copied with an .xlsx extension (not what i want)
the file is not copied
I want to copy the file, with a .json extension and have the embedded javascript in the destination.
Can you please share a debug log file with the error for the two points you've made? I can't see your screen. I don't know what you are doing so I can only go by what you post here with log files.
simon
(Simon Kenyon)
June 20, 2022, 3:39pm
11
failure to copy file:
rclone copy gd_test: --include /TestSpreadsheetWithEmbeddedAppsScript ./test --config=rclone.conf -vv --drive-export-formats=json
2022/06/20 14:23:35 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "copy" "gd_test:" "--include" "/TestSpreadsheetWithEmbeddedAppsScript" "./test" "--config=rclone.conf" "-vv" "--drive-export-formats=json"]
2022/06/20 14:23:35 DEBUG : Creating backend with remote "gd_test:"
2022/06/20 14:23:35 DEBUG : Using config file from "/home/ubuntu/rclone.conf"
2022/06/20 14:23:35 DEBUG : gd_test: detected overridden config - adding "{yboF8}" suffix to name
2022/06/20 14:23:35 DEBUG : fs cache: renaming cache item "gd_test:" to be canonical "gd_test{yboF8}:"
2022/06/20 14:23:35 DEBUG : Creating backend with remote "./test"
2022/06/20 14:23:35 DEBUG : fs cache: renaming cache item "./test" to be canonical "/home/ubuntu/test"
2022/06/20 14:23:35 DEBUG : TestSpreadsheetWithEmbeddedAppsScript.xlsx: Excluded
2022/06/20 14:23:35 DEBUG : Script to create backups in this folder.xlsx: Excluded
2022/06/20 14:23:35 DEBUG : Local file system at /home/ubuntu/test: Waiting for checks to finish
2022/06/20 14:23:35 DEBUG : Local file system at /home/ubuntu/test: Waiting for transfers to finish
2022/06/20 14:23:35 INFO : There was nothing to transfer
2022/06/20 14:23:35 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Elapsed time: 0.5s
2022/06/20 14:23:35 DEBUG : 4 go routines active
file copied, but with .xlsx extension and no javascript transferred
rclone copy gd_test: --include /TestSpreadsheetWithEmbeddedAppsScript.xlsx ./test --config=rclone.conf -vv --drive-export-formats=json
2022/06/20 15:38:23 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "copy" "gd_test:" "--include" "/TestSpreadsheetWithEmbeddedAppsScript.xlsx" "./test" "--config=rclone.conf" "-vv" "--drive-export-formats=json"]
2022/06/20 15:38:23 DEBUG : Creating backend with remote "gd_test:"
2022/06/20 15:38:23 DEBUG : Using config file from "/home/ubuntu/rclone.conf"
2022/06/20 15:38:23 DEBUG : gd_test: detected overridden config - adding "{yboF8}" suffix to name
2022/06/20 15:38:23 DEBUG : fs cache: renaming cache item "gd_test:" to be canonical "gd_test{yboF8}:"
2022/06/20 15:38:23 DEBUG : Creating backend with remote "./test"
2022/06/20 15:38:23 DEBUG : fs cache: renaming cache item "./test" to be canonical "/home/ubuntu/test"
2022/06/20 15:38:23 DEBUG : gd_test{yboF8}: Loaded invalid token from config file - ignoring
2022/06/20 15:38:23 DEBUG : Saving config "token" in section "gd_test" of the config file
2022/06/20 15:38:23 DEBUG : gd_test{yboF8}: Saved new token in config file
2022/06/20 15:38:23 DEBUG : Script to create backups in this folder.xlsx: Excluded
2022/06/20 15:38:23 DEBUG : Local file system at /home/ubuntu/test: Waiting for checks to finish
2022/06/20 15:38:23 DEBUG : Local file system at /home/ubuntu/test: Waiting for transfers to finish
2022/06/20 15:38:25 DEBUG : Local file system at /home/ubuntu/test: File to upload is small (4597 bytes), uploading instead of streaming
2022/06/20 15:38:25 DEBUG : TestSpreadsheetWithEmbeddedAppsScript.xlsx: md5 = b10b2b7e3f2d92c413a16d1ca699f062 OK
2022/06/20 15:38:25 INFO : TestSpreadsheetWithEmbeddedAppsScript.xlsx: Copied (new)
2022/06/20 15:38:25 DEBUG : TestSpreadsheetWithEmbeddedAppsScript.xlsx: Updating size of doc after download to 4597
2022/06/20 15:38:25 INFO : TestSpreadsheetWithEmbeddedAppsScript.xlsx: Copied (Rcat, new)
2022/06/20 15:38:25 INFO :
Transferred: 8.979 KiB / 8.979 KiB, 100%, 0 B/s, ETA -
Transferred: 3 / 3, 100%
Elapsed time: 2.0s
2022/06/20 15:38:25 DEBUG : 11 go routines active
simon
(Simon Kenyon)
June 20, 2022, 3:41pm
12
ncw wrote in his earlier response that using:
--drive-export-formats json
should have the desired effect. but i am obviously using it incorrectly.
ncw
(Nick Craig-Wood)
June 20, 2022, 3:54pm
13
simon:
ncw wrote in his earlier response that using:
--drive-export-formats json
should have the desired effect.
I thought you were copying a google apps script, not a spreadsheet with embedded google apps scripts.
Google apps scripts should be visible in your google drive if you do this - are they?
rclone lsf --drive-export-formats json gd_test:
As far as I know you can't export a spreadsheet as anything other than these mime types
application/pdf
application/vnd.oasis.opendocument.spreadsheet
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/x-vnd.oasis.opendocument.spreadsheet
application/zip
text/csv
text/tab-separated-values
The zip
format seems to export an html file with resources which might be what you want - I don't know.
simon
(Simon Kenyon)
June 20, 2022, 4:15pm
14
Google apps scripts should be visible in your google drive if you do this - are they?
rclone lsf --drive-export-formats json gd_test:
afraid not.
the zip file might have been a possibility. but that is designed for html.
so it looks like i am out of options.
thank you for your help.
I'm still confused on what the issue is.
I can copy an app script and it works.
I can copy a document/sheet and it works.
Can you please run that and share the full output?
rclone lsf --drive-export-formats json gd_test: -vvv
system
(system)
Closed
July 20, 2022, 4:36pm
16
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.