use python with gam, and this script.
import os
import subprocess
from csv import writer
from csv import reader
path to googleidlist.csv
csvfile = 'c:\GAM\googleidlist.csv'
destination = 'c:\GAM\OUTPUT\' #Destination for downloaded documents
Open the input_file in read mode and output_file in write mode
with open(csvfile, 'r') as read_obj, \
open('output_1.txt', 'w', newline='') as write_obj:
# Create a csv.reader object from the input file object
csv_reader = reader(read_obj)
# Create a csv.writer object from the output file object
csv_writer = writer(write_obj)
# Read each row of the input csv file as list
for row in csv_reader:
file_id = row[0]
outcome = subprocess.Popen(['gam', 'user', 'googleserviceaccountname', 'get', 'drivefile', 'id', file_id, 'targetfolder',destination], stdout=subprocess.PIPE)
# os.system("gam user [email protected] show fileinfo "+ file_id + "name")
filename = subprocess.Popen(['gam', 'user', 'googleserviceaccountname', 'show', 'fileinfo', file_id, 'name' ], stdout=subprocess.PIPE)
output = outcome.stdout.readline()
file_name = filename.stdout.readline()
print(output)
# Append the default text in the row / list
# row.append(filename)
row.append(output)
row.append(file_name)
row.append(file_id)
# Add the updated row / list to the output file
csv_writer.writerow(row)