taers232c / GAMADV-XTD3

Command line tool to manage Google Workspace
714 stars 87 forks source link

tdupdatesheet tdsheet not working ? #256

Closed lefoimpeur closed 2 years ago

lefoimpeur commented 2 years ago

Hi,

The "tdupdatesheet" attribute of the "todrive" parameter seems does not work with the "tdsheet" attribute. It never finds the sheet either with the name or the id.

Always the same error whether the name of the sheet is correct or fake : ERROR: Invalid User, Config File: C:\Users\zzz.gam\gam.cfg, Item: todrive_user, Value: zzz@yyy, Not Found

Command line : gam user xxxx@yyy print teamdrives role organizer | gam csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'" todrive tduploadnodata false tdfileid xxxx tdsheet id:0 tdupdatesheet

Other similar commands work perfectly, so the user is not invalid : gam user xxxx@yyy print teamdrives role organizer | gam csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'" todrive tduploadnodata false tdparent id:xxxx gam user xxxx@yyy print teamdrives role organizer | gam csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'" todrive tduploadnodata false tdfileid xxxx tdcopysheet id:0

Is this a bug or syntax error on mine ?

(I'm usign 6.16.18 version)

Thanks in advance

taers232c commented 2 years ago

Send me a Meet/Zoom invitation and I'll help you get the data you want.

ross.scroggs @ gmail.com

taers232c commented 2 years ago

This is going to overwrite the sheet for each team drive:

gam user xxxx@yyy print teamdrives role organizer | gam csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'" todrive tduploadnodata false tdfileid xxxx tdsheet id:0 tdupdatesheet

To get a single sheet:

gam user xxxx@yyy print teamdrives role organizer | gam redirect csv - todrive tduploadnodata false tdfileid xxxx tdsheet id:0 tdupdatesheet csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'" 

Open Sheets file xxxx, select the tab of interest, look at the URL, the id is here: gid=12345, put that value in the command

lefoimpeur commented 2 years ago

Thank you, I will test that next week.

taers232c commented 2 years ago

This error implies that the todrive_user value in gam.cfg is incorrect. 'ERROR: Invalid User, Config File: C:\Users\zzz.gam\gam.cfg, Item: todrive_user, Value: zzz@yyy, Not Found'

Do: gam config verify Verify that the value zzz@yyy is a valid email address.

lefoimpeur commented 2 years ago

the value is good because with another command todrive it's ok

taers232c commented 2 years ago

Send me a Meet/Zoom invitation

@.***

On Mar 18, 2022, at 9:16 AM, lefoimpeur @.***> wrote:

the value is good because with another command todrive it's ok

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/256#issuecomment-1072567541, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLYHOJN5BM2ETLEDESTVAST67ANCNFSM5RBYQEYA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.

lefoimpeur commented 2 years ago

Hi,

In my gam config file --> todrive_user = '' So by default it must use my account.

Configuration is good because with another command todrive it's ok, example : gam user xxxx@yyy print teamdrives role organizer | gam csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'" todrive tduploadnodata false tdparent id:xxxx

Capture d’écran 2022-03-21 à 09 09 21

Capture d’écran 2022-03-21 à 09 10 53

And if I put my email --> todrive_user = zzz@yyy I've got same error

taers232c commented 2 years ago

I'm in California (PDT), please send a Meet/Zoom invitation and I'll help solve your issue. I'm not able to solve it via email.

Ross

On Mon, Mar 21, 2022 at 1:36 AM lefoimpeur @.***> wrote:

Hi,

In my gam config file --> todrive_user = '' So by default it must use my account.

Configuration is good because with another command todrive it's ok, example : gam user @.*** print teamdrives role organizer | gam csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'" todrive tduploadnodata false tdparent id:xxxx

[image: Capture d’écran 2022-03-21 à 09 09 21] https://user-images.githubusercontent.com/7026864/159226888-36cb1b31-4c22-4c04-98ca-843b46ccb3e7.png

[image: Capture d’écran 2022-03-21 à 09 10 53] https://user-images.githubusercontent.com/7026864/159226917-ab8e6873-8bcc-4259-a76a-e5096eab9f89.png

And if I put my email --> todrive_user = @.*** I've got same error

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/256#issuecomment-1073633607, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLYNPEPSKGCHOCYR33LVBAYHFANCNFSM5RBYQEYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

-- Ross Scroggs @.***

lefoimpeur commented 2 years ago

Hi, I can't do that, it's for my company :-(

taers232c commented 2 years ago

What is: gam version

Do: gam config verify Note: admin_email and todrive_user Do: gam oauth info Note: Google Workspace Admin

When you do todrive, GAM uses the first address it finds 1) todrive_user 2) admin_email 3) Google Workspace Admin

For any of these addresses do the following to verify drive access: gam user @.*** show drivesettings

Ross

@.***

On Mar 23, 2022, at 1:33 AM, lefoimpeur @.***> wrote:

Hi, I can't di that, it's for my company :-(

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/256#issuecomment-1076083356, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLZEFXWFRNHTEULK77TVBLJNHANCNFSM5RBYQEYA. You are receiving this because you commented.

lefoimpeur commented 2 years ago

Hi,

1) todrive_user is blank 2) admin_email is blank 3) Google Workspace Admin = my adm email = zzz@yyy in my example

taers232c commented 2 years ago

Again, what is you GAM version?

@.***

On Mar 25, 2022, at 6:27 AM, lefoimpeur @.***> wrote:

Hi,

todrive_user is blank admin_email is blank Google Workspace Admin = my adm email = @.*** in my example — Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/256#issuecomment-1079027117, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLY5C3DNYIANXEJZAMLVBW5K3ANCNFSM5RBYQEYA. You are receiving this because you commented.

lefoimpeur commented 2 years ago

GAMADV 6.16.18

taers232c commented 2 years ago

Show a command that works and one that doesn't, the screen shots with the redactions are hard to read, copy the output into a file. Replace actual addresses with admin@domain.com for your workspace admin and user@domain.com for any other address.

lefoimpeur commented 2 years ago

Command NOK :

c:\outils\gam-xtd>gam user user@domain.com print teamdrives role organizer | gam redirect csv - todrive tduploadnodata false tdfileid xxx tdsheet id:yyy tdupdatesheet csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'"
Getting all Shared Drives for user@domain.com
Got 8 Shared Drives...
User: admin@domain.com, Service not applicable/Does not exist
Command: gam redirect csv - >>>todrive<<< tduploadnodata false tdfileid xxx tdsheet id:yyy tdupdatesheet csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'"

ERROR: Invalid User, Config File: C:\Users\admin\.gam\gam.cfg, Item: todrive_user, Value: admin@domain.com, Not Found
Help: Syntax in file c:\outils\gam-xtd\GamCommands.txt
Help: Documentation is at https://github.com/taers232c/GAMADV-XTD3/wiki

Command OK :

c:\outils\gam-xtd>gam user user@domain.com print teamdrives role organizer | gam csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'" todrive tduploadnodata false tdparent id:yyy
Getting all Shared Drives for user@domain.com
Got 8 Shared Drives...
2022-03-25T15:47:18.008+00:00,0/5,Using 5 processes...
Getting all Drive Files/Folders that match query ((visibility = 'domainWithLink')) for user@domain.com
Getting all Drive Files/Folders that match query ((visibility = 'domainWithLink')) for user@domain.com
Getting all Drive Files/Folders that match query ((visibility = 'domainWithLink')) for user@domain.com
Getting all Drive Files/Folders that match query ((visibility = 'domainWithLink')) for user@domain.com
Getting all Drive Files/Folders that match query ((visibility = 'domainWithLink')) for user@domain.com
Got 1 Drive File/Folder that matched query ((visibility = 'domainWithLink')) for user@domain.com...
Got 1 Drive File/Folder that matched query ((visibility = 'domainWithLink')) for user@domain.com...
Got 0 Drive Files/Folders that matched query ((visibility = 'domainWithLink')) for user@domain.com...
No CSV data to upload
Got 0 Drive Files/Folders that matched query ((visibility = 'domainWithLink')) for user@domain.com...
No CSV data to upload
Got 40 Drive Files/Folders that matched query ((visibility = 'domainWithLink')) for user@domain.com...
Data uploaded to Drive File:
https://docs.google.com/spreadsheets/d/xxx/edit?usp=drivesdk
Data uploaded to Drive File:
https://docs.google.com/spreadsheets/d/xxx/edit?usp=drivesdk
Data uploaded to Drive File:
https://docs.google.com/spreadsheets/d/xxx/edit?usp=drivesdk

gam config :

c:\outils\gam-xtd>gam config verify
Section: DEFAULT
  activity_max_results = 100
  admin_email = ''
  api_calls_rate_check = false
  api_calls_rate_limit = 100
  auto_batch_min = 0
  batch_size = 50
  cacerts_pem = ''
  cache_dir = C:\Users\admin\.gam\gamcache
  cache_discovery_only = true
  charset = mbcs
  classroom_max_results = 0
  client_secrets_json = client_secrets.json ; C:\Users\admin\.gam\client_secrets.json
  cmdlog = ''
  cmdlog_max_backups = 5
  cmdlog_max_kilo_bytes = 1000
  config_dir = C:\Users\admin\.gam
  contact_max_results = 100
  csv_input_column_delimiter = ,
  csv_input_quote_char = '"'
  csv_input_row_drop_filter = ''
  csv_input_row_filter = ''
  csv_output_column_delimiter = ,
  csv_output_convert_cr_nl = false
  csv_output_field_delimiter = ' '
  csv_output_header_drop_filter = ''
  csv_output_header_filter = ''
  csv_output_line_terminator = lf
  csv_output_quote_char = '"'
  csv_output_row_drop_filter = ''
  csv_output_row_filter = ''
  csv_output_subfield_delimiter = .
  csv_output_timestamp_column = ''
  csv_output_users_audit = false
  customer_id = my_customer
  debug_level = 0
  device_max_results = 200
  domain = ''
  drive_dir = C:\Users\admin\Downloads
  drive_max_results = 1000
  drive_v3_native_names = true
  email_batch_size = 50
  enable_dasa = false
  event_max_results = 250
  extra_args = ''
  inter_batch_wait = 0
  member_max_results = 200
  message_batch_size = 50
  message_max_results = 500
  mobile_max_results = 100
  multiprocess_pool_limit = 0
  never_time = Never
  no_browser = true
  no_cache = false
  no_update_check = true
  no_verify_ssl = true
  num_tbatch_threads = 2
  num_threads = 5
  oauth2_txt = oauth2.txt ; C:\Users\admin\.gam\oauth2.txt
  oauth2service_json = oauth2service.json ; C:\Users\admin\.gam\oauth2service.json
  people_max_results = 100
  quick_info_user = false
  section = ''
  show_api_calls_retry_data = false
  show_commands = false
  show_convert_cr_nl = false
  show_counts_min = 1
  show_gettings = true
  show_gettings_got_nl = false
  show_multiprocess_info = false
  smtp_fqdn = ''
  smtp_host = ''
  smtp_password =
  smtp_username = ''
  timezone = utc
  tls_max_version = ''
  tls_min_version = ''
  todrive_clearfilter = false
  todrive_clientaccess = false
  todrive_conversion = true
  todrive_localcopy = false
  todrive_locale = ''
  todrive_nobrowser = true
  todrive_noemail = true
  todrive_parent = root
  todrive_sheet_timeformat = ''
  todrive_sheet_timestamp = false
  todrive_timeformat = ''
  todrive_timestamp = false
  todrive_timezone = ''
  todrive_upload_nodata = true
  todrive_user = ''
  update_cros_ou_with_id = false
  user_max_results = 500
  user_service_account_access_only = false

gam oauth info :

c:\outils\gam-xtd>gam oauth info
Client OAuth2 File: C:\Users\admin\.gam\oauth2.txt
Client ID: xxx.apps.googleusercontent.com
Scopes: 45
  https://apps-apis.google.com/a/feeds/compliance/audit/
  https://sites.google.com/feeds
  https://www.google.com/m8/feeds
  https://www.googleapis.com/auth/admin.chrome.printers
  https://www.googleapis.com/auth/admin.contact.delegation
  https://www.googleapis.com/auth/admin.datatransfer
  https://www.googleapis.com/auth/admin.directory.customer
  https://www.googleapis.com/auth/admin.directory.device.chromebrowsers
  https://www.googleapis.com/auth/admin.directory.device.chromeos
  https://www.googleapis.com/auth/admin.directory.device.mobile
  https://www.googleapis.com/auth/admin.directory.domain
  https://www.googleapis.com/auth/admin.directory.group
  https://www.googleapis.com/auth/admin.directory.orgunit
  https://www.googleapis.com/auth/admin.directory.resource.calendar
  https://www.googleapis.com/auth/admin.directory.rolemanagement
  https://www.googleapis.com/auth/admin.directory.user
  https://www.googleapis.com/auth/admin.directory.user.security
  https://www.googleapis.com/auth/admin.directory.userschema
  https://www.googleapis.com/auth/admin.reports.audit.readonly
  https://www.googleapis.com/auth/admin.reports.usage.readonly
  https://www.googleapis.com/auth/apps.groups.migration
  https://www.googleapis.com/auth/apps.groups.settings
  https://www.googleapis.com/auth/apps.licensing
  https://www.googleapis.com/auth/calendar
  https://www.googleapis.com/auth/chrome.management.policy
  https://www.googleapis.com/auth/chrome.management.reports.readonly
  https://www.googleapis.com/auth/chrome.management.telemetry.readonly
  https://www.googleapis.com/auth/classroom.announcements
  https://www.googleapis.com/auth/classroom.courses
  https://www.googleapis.com/auth/classroom.coursework.students
  https://www.googleapis.com/auth/classroom.courseworkmaterials
  https://www.googleapis.com/auth/classroom.guardianlinks.students
  https://www.googleapis.com/auth/classroom.profile.emails
  https://www.googleapis.com/auth/classroom.profile.photos
  https://www.googleapis.com/auth/classroom.rosters
  https://www.googleapis.com/auth/classroom.topics
  https://www.googleapis.com/auth/cloud-identity.groups
  https://www.googleapis.com/auth/contacts
  https://www.googleapis.com/auth/devstorage.read_only
  https://www.googleapis.com/auth/directory.readonly
  https://www.googleapis.com/auth/ediscovery
  https://www.googleapis.com/auth/siteverification
  https://www.googleapis.com/auth/userinfo.email
  https://www.googleapis.com/auth/userinfo.profile
  openid
Google Workspace Admin: admin@domain.com
Expires: 2022-03-25T17:40:26+00:00
taers232c commented 2 years ago

In the first command you have: tdfileid xxx tdsheet id:yyy tdupdatesheet In the second command you have: tdparent id:yyy

Both commands work for me.

Test the second command with tdfileid xxx tdsheet id:yyy tdupdatesheet Is there any change?

taers232c commented 2 years ago

In the first command, each teamdrive processed is updating the same file, you should add the multiprocess keyword as show below to get all of the data in the file:


gam user user@domain.com print teamdrives role organizer | gam redirect csv - multiprocess todrive tduploadnodata false tdfileid xxx tdsheet id:yyy tdupdatesheet csv - gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'"```
taers232c commented 2 years ago

From the first command: tdfileid xxx

Do: gam user admin@domain.com show fileinfo xxx

taers232c commented 2 years ago

Split the first command into two parts; does this make any difference?

gam redirect csv ./teamsdrive.csv user user@domain.com print teamdrives role organizer 

gam redirect csv - multiprocess todrive tduploadnodata false tdfileid xxx tdsheet id:yyy tdupdatesheet csv ./teamdrives.csv gam user ~User print filelist select teamdriveid ~id query "visibility = 'domainWithLink'"
taers232c commented 2 years ago

Do:

gam user admin@domain.com check serviceaccount

What do you get for:

  https://www.googleapis.com/auth/spreadsheets                              ???? (25/26)
taers232c commented 2 years ago

Has your issue been resolved?

lefoimpeur commented 2 years ago

Hi,

No and I didn't test your suggestions. Furthermore, this topic is currently on break. I'll be sure to inform you of my actions as soon as possible. Thanks