Can't copy Office doc to Google Drive when Google doc with same base name already exists

What is the problem you are having with rclone?

Here's how to recreate the problem:

  1. In My Drive, create a new Google Sheet named Inventory.
  2. In OneDrive, upload a spreadsheet named Inventory.xlsx.
  3. Attempt to Rclone copy OneDrive to My Drive.

2022/07/07 13:47:08 ERROR : Inventory.xlsx: Failed to copy: can't update google document type without --drive-import-formats

  1. Rename the OneDrive file to Inventory2.xlsx.
  2. Attempt to Rclone copy OneDrive to My Drive.

2022/07/07 13:54:57 INFO : Inventory2.xlsx: Copied (new)

  1. Rename the new My Drive file to Inventory.xlsx.

The implication is that Rclone is attempting to overwrite the existing Google Sheet named Inventory, and that seems like the bug. Google Drive does not mind having a Google Sheet named Inventory and a Microsoft Excel doc named Inventory.xlsx.

Run the command 'rclone version' and share the full output of the command.

rclone v1.58.1
- os/version: Microsoft Windows 11 Home 21H2 (64 bit)
- os/kernel: 10.0.22000.675 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.17.9
- go/linking: dynamic
- go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

OneDrive -> Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

"rclone.exe" "copy" "--check-first" "--config" "tmpCD57.tmp" "--log-file" "rclone.log" "--order-by" "size,mixed" "--retries" "1" "--stats" "5s" "--stats-one-line-date" "--update" "--log-level" "DEBUG" "--drive-skip-dangling-shortcuts" "--drive-skip-shortcuts" "--drive-auth-owner-only" "--create-empty-src-dirs" "Source:" "Target:"

The rclone config contents with secrets removed.

[Source]
type = onedrive
client_id = ...
client_secret = ...
token = {"access_token":"...","token_type":"Bearer","refresh_token":"none","expiry":"2022-07-07T14:54:52.1268636-05:00"}
token_url = http://localhost:1976/m365/refreshTokenProxy
drive_id = ...
drive_type = business
[Target]
type = drive
scope = drive
service_account_file = C:\Temp\target.json
impersonate = user@example.org

A log from the command with the -vv flag

2022/07/07 13:47:08 ERROR : Inventory.xlsx: Failed to copy: can't update google document type without --drive-import-formats
2022/07/07 13:47:08 ERROR : Attempt 1/1 failed with 1 errors and: can't update google document type without --drive-import-formats
2022/07/07 13:47:08 INFO  : 2022/07/07 13:47:08 -           0 B / 0 B, -, 0 B/s, ETA -
2022/07/07 13:47:08 DEBUG : 11 go routines active
2022/07/07 13:47:08 Failed to copy: can't update google document type without --drive-import-formats

Rclone would do that if you allowed it to with --drive-import-formats

Rclone adds extensions to Google docs but you can choose which ones with --drive-export-formats

You can also skip the Google docs completely with --drive-skip-gdocs

It's all explained here: Google drive in the Import/Export of google documents section

I've seen and read that doc, but I don't understand how it applies to my scenario. I don't want Inventory.xlsx to be converted into a different format, nor do I want it to overwrite the existing Google Sheet named Inventory. My goal is, at the end of the copy, to have both Inventory (a pre-existing Google Sheet) and Inventory.xlsx (a new Excel spreadsheet copied by Rclone). By not using --drive-import-formats, the doc says no conversion will be applied. That's what I want, but the copy isn't happening.

I'm not exporting anything from Google Drive, so I do not believe --drive-export-formats applies. It's unclear to me what --drive-skip-gdocs would do for me here.

It would ignore the fact you have an existing Google Sheet called the same name and upload it.

image

That's my test sheet I created.

Upload fails since the API wants to replace the existing google sheet:

rclone copy test.xlsx GD: -vvv
2022/07/07 20:38:32 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "copy" "test.xlsx" "GD:" "-vvv"]
2022/07/07 20:38:32 DEBUG : Creating backend with remote "test.xlsx"
2022/07/07 20:38:32 DEBUG : Using config file from "/Users/etexter/.config/rclone/rclone.conf"
2022/07/07 20:38:32 DEBUG : fs cache: adding new entry for parent of "test.xlsx", "/Users/etexter/Downloads"
2022/07/07 20:38:32 DEBUG : Creating backend with remote "GD:"
2022/07/07 20:38:33 DEBUG : Google drive root '': 'root_folder_id = 0AGoj85v3xeadUk9PVA' - save this in the config to speed up startup
2022/07/07 20:38:33 DEBUG : test.xlsx: Modification times differ by 2m18.595596834s: 2022-07-07 20:36:06.082403166 -0400 EDT, 2022-07-08 00:38:24.678 +0000 UTC
2022/07/07 20:38:33 ERROR : test.xlsx: Failed to copy: can't update google document type without --drive-import-formats
2022/07/07 20:38:33 ERROR : Attempt 1/3 failed with 1 errors and: can't update google document type without --drive-import-formats
2022/07/07 20:38:33 DEBUG : test.xlsx: Modification times differ by 2m18.595596834s: 2022-07-07 20:36:06.082403166 -0400 EDT, 2022-07-08 00:38:24.678 +0000 UTC
2022/07/07 20:38:33 ERROR : test.xlsx: Failed to copy: can't update google document type without --drive-import-formats
2022/07/07 20:38:33 ERROR : Attempt 2/3 failed with 1 errors and: can't update google document type without --drive-import-formats
2022/07/07 20:38:33 DEBUG : test.xlsx: Modification times differ by 2m18.595596834s: 2022-07-07 20:36:06.082403166 -0400 EDT, 2022-07-08 00:38:24.678 +0000 UTC
2022/07/07 20:38:33 ERROR : test.xlsx: Failed to copy: can't update google document type without --drive-import-formats
2022/07/07 20:38:33 ERROR : Attempt 3/3 failed with 1 errors and: can't update google document type without --drive-import-formats
2022/07/07 20:38:33 INFO  :
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         0.8s

2022/07/07 20:38:33 DEBUG : 7 go routines active
2022/07/07 20:38:33 Failed to copy: can't update google document type without --drive-import-formats

If you skip the Google Docs that exist.

rclone copy test.xlsx GD: -vvv --drive-skip-gdocs
2022/07/07 20:39:45 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "copy" "test.xlsx" "GD:" "-vvv" "--drive-skip-gdocs"]
2022/07/07 20:39:45 DEBUG : Creating backend with remote "test.xlsx"
2022/07/07 20:39:45 DEBUG : Using config file from "/Users/etexter/.config/rclone/rclone.conf"
2022/07/07 20:39:45 DEBUG : fs cache: adding new entry for parent of "test.xlsx", "/Users/etexter/Downloads"
2022/07/07 20:39:45 DEBUG : Creating backend with remote "GD:"
2022/07/07 20:39:45 DEBUG : GD: detected overridden config - adding "{YRXYK}" suffix to name
2022/07/07 20:39:45 DEBUG : Google drive root '': 'root_folder_id = 0AGoj85v3xeadUk9PVA' - save this in the config to speed up startup
2022/07/07 20:39:45 DEBUG : fs cache: renaming cache item "GD:" to be canonical "GD{YRXYK}:"
2022/07/07 20:39:46 DEBUG : test.xlsx: Need to transfer - File not found at Destination
2022/07/07 20:39:46 DEBUG : test.xlsx: md5 = deb551d189dfcc7d1b168d7d17e0628a OK
2022/07/07 20:39:46 INFO  : test.xlsx: Copied (new)
2022/07/07 20:39:46 INFO  :
Transferred:   	    8.534 KiB / 8.534 KiB, 100%, 0 B/s, ETA -
Transferred:            1 / 1, 100%
Elapsed time:         1.3s

2022/07/07 20:39:46 DEBUG : 7 go routines active

Ah, I see. I hadn't understood --drive-skip-gdocs to be relevant to the target side of the equation.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.