Updating signatures from a csv file

253 views
Skip to first unread message

Eddie Dawydiuk

unread,
Apr 9, 2024, 1:22:14 PM4/9/24
to GAM for Google Workspace
Hello,

I need to update every signature in the company to make them consistent. I've used the command "gam all users print sendas > sendas.csv" to get a list of every signature, and I've updated signatures in a new csv file. 

The first step I'm hoping to do is to just update my signature as a proof of concept before updating every user's signature. I'm not sure I understand the arguments for the gam update command. It looks like I should use the command 

gam csv sendas_updated.csv gam update sendas "~signature"

but I don't know how to safely test if my understanding is correct and most definately don't want to break every signature in the company finding out my understanding was wrong. Is the command correct? Is there a way to sandbox test stuff like this?

Lastly is there a way to prevent people from changing their signatures, please ignore if this is the wrong place to ask this question...


Thanks,
Eddie

Ben Davidson

unread,
Apr 9, 2024, 5:40:14 PM4/9/24
to GAM for Google Workspace
Hi Eddie,

I'll start with the last since it may effect your choices on the rest. There is no setting to prevent users from changing their signatures, but you can "brute enforce" standardization by simply updating everyone's signatures say every hour. So even if they change it, it will soon be set back.

Some time ago I went down the same road as you, planning to use a .csv I updated by hand with GAM. Ultimately I found pulling the users live contact and related work info (title, department, etc) and adding any custom schema we wanted (pronoun etc) to be more usable and has the added benefit of automatically building out your employee records.

In my case I adapted a version of what this fellow designed around Apps Script and some custom user fields. Since you might be running whatever script you create all day every day to enforce the policy, it's also nice that GAS is "free" to run.


Btw watch out for the fact that Google's API doesn't support a couple things you might assume it does, for instance you can set the users signature for new messages, but there is no way to set the signature for replies. Google defaults signature on reply to off, but if your company culture requires it on every message (and especially if have already set it that way), you'll still need to prompt users to make that one setting themselves.


What you have there using sendas is not correct... that would be for adding/updating accounts the user can send from.

Cheers,

Ben

Ross Scroggs

unread,
Apr 9, 2024, 6:24:16 PM4/9/24
to google-ap...@googlegroups.com
Eddie,

I'm in California (PDT) and can help you. I'm generally available starting at 7:30AM PDT.
Send me a Meet/Zoom invitation.

Ross
----
Ross Scroggs



--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/4ca51029-aa90-44e4-b286-191504168b8bn%40googlegroups.com.

Eddie Dawydiuk

unread,
Apr 15, 2024, 11:04:47 AM4/15/24
to GAM for Google Workspace
I got this working, here is how I ended up solving the problem for anyone else with the same issue. If anyone sees a problem with this solution, please let me know.

I got a list of all current signatures in a csv file with this command: 

gam all users print sendas > sendas_04_10_2024.csv

I then used this command as a proof of concept to change one signature:

gam user user@mydomain.com signature "hello world"

I then modified the csv file for every user to set the new signature I wanted. Please note we wanted to give every user the choice of 3 possible signatures and we don't have meta-data populated(job title) so this was a manual process to define each signature, but if everyone in the company had the exact same signature I would have populated Job Titles and scripted this(setting the new signature) to save time and ensure consistency...

import csv
import subprocess

with open('updated_sendas_04_10_2024.csv') as csv_file:
    csv_reader = csv.reader(csv_file, delimiter=',')
    line_count = 0
    for row in csv_reader:

        #Assume first row are headers
        if line_count == 0:
            line_count += 1
        else:
            line_count += 1

            #Assume 1st column is username and 9th is new signature
            username = row[0]
            newsig = row[8]

            #escape double quotes in signature
            newsig = newsig.replace('"', '\\"')

            print(f'gam user {username} signature "{newsig}"')
            subprocess.Popen(f'gam user {username} signature "{newsig}"', shell=True)
Reply all
Reply to author
Forward
0 new messages