Currently, there is no way to customize which fields you want to be included in a donation history export. And, with over 200 columns in that export, deleting all the ones you don't need can be a hassle — particularly if you need to do this on a regular basis (e.g., for your accountant).
NationBuilder is looking into adding the ability to customize these exports, similar to how you can customize people exports. In the meantime, here's a trick for automating that work using an Excell Macro.
Note: These instructions are for Microsoft Excel (Version 16.13.1) for Mac.
1. First, export your desired transactions from Finances. Not sure how? Read this HOWTO.
2. Next, open that CSV export in Excel.
3. In the Excel navigation menu, select Tools > Macro > Macros.
4. In the Macro popup window, enter a name for your new macro (e.g. "deleteIrrelevantColumns"), then click the "+" icon.
5. Copy/paste the following snippet into the VBA macro editor:
Sub deleteIrrelevantColumns() Dim currentColumn As Integer Dim columnHeading As String ActiveSheet.Columns("L").delete For currentColumn = ActiveSheet.UsedRange.Columns.Count To 1 Step -1 columnHeading = ActiveSheet.UsedRange.Cells(1, currentColumn).Value 'CHECK WHETHER TO KEEP THE COLUMN Select Case columnHeading Case "donation_nationbuilder_id", "amount", "payment_type_name", "created_at", "tracking_code_slug", "signup_first_name", "signup_last_name", "signup_employer", "signup_occupation", "signup_email1", "signup_phone_number", "signup_billing_country", "signup_billing_state", "signup_billing_city", "signup_billing_zip", "signup_billing_address1", "signup_billing_address2" 'Do nothing Case Else 'Delete if the cell doesn't contain "Homer" If InStr(1, _ ActiveSheet.UsedRange.Cells(1, currentColumn).Value, _ "Homer", vbBinaryCompare) = 0 Then ActiveSheet.Columns(currentColumn).delete End If End Select Next End Sub
The headings for the fields you want to keep are listed after the first "Case" statement; all other columns will be deleted. As is, this macro will leave you with just 17 columns: 5 key fields for the transaction, and 12 basic fields for the donor (address, contact info, and two cumulative donation history fields). You can add or remove additional headings from the Macro editor.
6. Once you're ready, click the "Run" button like so:
Now, whenever you need to rerun this macro, it should be accessible under Tools > Macro > Macros. Just select it and click run from the initial popup window:
Thanks to David Zemens, from whose StackOverflow response I adopted the macro.
Showing 3 reactions
Sign in with