I use Google Apps Script to send emails, sometimes from @gmail.com addresses. Those emails are very frequently going to the SPAM folder.
I understand it's possible to set up SPF and DKIM in my domain's DNS settings. Is it possible to do something like that for these @gmail.com emails?
Short answer: no.
This is because you don't manage
gmail.com. If you want to implement SPF/DKIM/DMARC you should get a domain of your own and specify the settings there.Regarding the first sentence: if your email is sent to spam, then investigate why that is. Or, better yet, send the email authenticated rather than anonymously. Yes, making an assumption here.