If you convert to CSV, emailing the non-payers is a one-liner in Powershell. Even converting the XLSX to CSV is pretty easy with the Excel .NET libraries, and well-documented in blog posts and StackOverflow.
Sometimes, the bigger challenge with automation is getting users to see a service, function, or utility as the underlying algorithms and calls, and not as this immutable black box interface. Once viewed this way, it's easier to separate automation into more easily defined goals.
---
Foreach ($nonpayer in (Import-CSV ("C:\billing\" + (get-date -F MM) + ".CSV") | where {$_.pmt -eq 0})) { Send-MailMessage -from [email protected] -to $nonpayer.email -SMTPserver relay.example.com -title " Payment Overdue" -body "Hello $($nonpayer.first-name), your payment for $(get-date -f MMMM) was not received. Please send payment today."};
You probably don't want to be hard-coding the address of your SMTP forwarding host in a script. If you have to change to a different one, you will have to hunt down this sort of usage and fix it.
Yes, but if it weren't hard-coded, it wouldn't count as being a one-liner. ;)
Besides, it's rare for DNS names to change; the point of DNS is the underlying server addresses can change without changing the name. And a service like SMTP relay should be less likely to change than other types of host.
But still, good point. This could easily be a Param if the function would be used in many environments.
Sometimes, the bigger challenge with automation is getting users to see a service, function, or utility as the underlying algorithms and calls, and not as this immutable black box interface. Once viewed this way, it's easier to separate automation into more easily defined goals.
---
Foreach ($nonpayer in (Import-CSV ("C:\billing\" + (get-date -F MM) + ".CSV") | where {$_.pmt -eq 0})) { Send-MailMessage -from [email protected] -to $nonpayer.email -SMTPserver relay.example.com -title " Payment Overdue" -body "Hello $($nonpayer.first-name), your payment for $(get-date -f MMMM) was not received. Please send payment today."};
(I wrote this on the bus on my phone)