Export Trello to Excel to Access to Excel


Trello is an open source web based project management application which organizes your project information into boards. A board could represent a project. Within each board you create cards that represent comments, requirements or bugs that were found. Each card is placed in a column of cards which might represent the stages that a project goes through and perhaps the name of the person who added the card as an input. You also have the ability to attach documents (PDF, Word, Excel and so on) to a card and add comments to a card. You can move cards to different boards. For example you have an input card reporting a software bug that was fixed by the development and you want to move that to the column called Staging Release. In other words, you can set this up any way you want.

You may have the need to work with, analyze and report that data to other users in your project. Trello has several boards where you categorize the project based on criteria you set up. Each category (column) could be inputs from a team of people or persons. It could be based on time. For example a comment may be reporting a bug in an imput column and then moved to a “fixed on ” column. The Excel that Trello produces has in the first column, the name of the Trello column.

Here are the major steps involved.

  1. Export from Trello to Excel
  2. Import Excel into Access
  3. Create Queries you want
  4. Export all Queries to an Excel file where each query is in its own worksheet
  5. Open Excel and Save As an Excel Macro-Enabled Workbook (*.xlsm)
  6. Format data in all Excel worksheets at once with the code below

Export from Trello to Excel

There is an article at Oodles Technologies that explains how you can export “all” of your Trello data to Excel.

This solution relies on a Chrome Web store extension named Export for Trello. You will need to install this first.

Import Excel into Access

First, create an Access file. In the menu, click on External Data, New Data Source, From File, Excel. Work through the short Wizard. Browse out to find the location of the Excel file you exported from Trello. Select the radio button: Import the source data into a new table in the current database. Select the worksheet you want to import and click Next. Since the first row does contain column headings, click the check box at the top of the next page in the wizard and click Next. Just click Next in the next page of the wizard as you don’t need to define the data in the columns. Go ahead and let Access define a primary key by adding a column called ID and populating it with a sequence of numbers. Click Next. Change the name of the table being created, if you want. Click Finish with analyzing the data. Click Save import steps and provide a description in the next screen. Click the Save Import button. You are done.

Create Queries

Create the queries you need. Once you create them you won’t need to create them again. You many want a separate query for each Trello column. You just need to create a filer in the Criteria row of the graphical interface. Just surround the first column name with single quotes. You may want to create a query that runs other filters by combining similar columns. You may want to create queries that filter out certain label values.

Export all Queries to Several Excel Files

Now you can create a form in Access that allows you to export all of the queries to a series of Excel sheets, one for each query. Once that is done, the next step will combine all of the Excel files into one Excel file with separate worksheets for each query.

Here is a website at UtterAccess the explains how to do this step. I needed to change the code from Tables to Queries and the resulting code is below. I needed to change code in the following line numbers: 22 to 26, 29 and 31. For example, instead of TableDef, we need QueryDef and instead of strTables we should be using strQueries.

1Option Compare Database
2Option Explicit
3Private Sub Command4_Click()
4  Dim strFile As String
5  Dim varItem As Variant
6  strFile = InputBox("Path and file name to export to...", "Export")
7     
8  If (strFile = vbNullString) Then Exit Sub
9     
10  For Each varItem In Me.List0.ItemsSelected
11        DoCmd.TransferSpreadsheet transferType:=acExport, _
12                spreadsheetType:=acSpreadsheetTypeExcel9, _
13                tableName:=Me.List0.ItemData(varItem), _
14                FileName:=strFile
15  Next
16  MsgBox "Process complete.", vbOKOnly, "Export"
17End Sub
18 
19Private Sub Form_Open(Cancel As Integer)
20  ' put a list of all the queries into the list box
21  Dim strQueries As String
22  Dim qdf As QueryDef
23  For Each qdf In CurrentDb.QueryDefs
24        If (Left(qdf.Name, 4) <> "MSys") Then
25            strQueries = strQueries & qdf.Name & ","
26        End If
27   Next
28   strQueries = Left(strQueries, Len(strQueries) - 1)
29     
30   Me.List0.RowSource = strQueries
31End Sub

Open Excel and Save As an Excel Macro-Enabled Workbook

Open your Excel file and save it as a new file that is macro-enabled and give it a new name.

Format data in all Excel worksheets at once

There are a few macros you can run to do things in all of your worksheets inside an Excel file. To open up the VBA code window, press Alt+F11. In the window at the upper left called Project – VBA Project, scroll down the list and double-click on ThisWorkbook to open a window to paste the code below. Save it. Go back to Excel and click Macros under the Developer tab.

1' Coded by Mike Porter and Dioni Paulo
2' Date: 2018-09-13
3'
4Sub S00_RUN_ALL()
5    S01_Set_Calibri_11
6    S02_BoldRow1AllWorksheets
7    S03_SelectA2CellinAllWorksheets
8    S04_FreezeAllSheets
9    S05_WidenColumnABHIJ_CD
10    S06_SelectJ2CellinAllWorksheets
11    S09_CreateHyperlinks
12    S01_Set_Calibri_11   ' S09 for some reason changes the font
13    S03_SelectA2CellinAllWorksheets
14    S10_MakeFirstWorksheetActive
15    MsgBox ("Done Formatting Excel Worksheets.")
16End Sub
17Sub S01_Set_Calibri_11()
18    Dim ws As Worksheet
19    For Each ws In ActiveWorkbook.Worksheets
20         With ws
21            .Cells.Font.Name = "Calibri"
22            .Cells.Font.Size = 11
23         End With
24    Next ws
25End Sub
26Sub S02_BoldRow1AllWorksheets()
27    'make the first row bold in all worksheets
28    Dim ws As Worksheet
29    For Each ws In Worksheets
30         With ws.Range("1:1")
31            .Font.Bold = True
32         End With
33    Next ws
34End Sub
35Sub S03_SelectA2CellinAllWorksheets()
36    ' do this before freezing
37    Dim ws As Worksheet
38    For Each ws In ActiveWorkbook.Sheets
39       ws.Select
40       Range("A2").Select
41    Next ws
42End Sub
43Sub S04_FreezeAllSheets()
44   'Code source: www.contextures.com
45   Dim wsA As Worksheet
46   Dim ws As Worksheet
47   Dim wbA As Workbook
48   Dim strSel As String
49   Dim lRsp As Long
50   On Error GoTo errHandler
51   Set wbA = ActiveWorkbook
52   Set wsA = ActiveSheet
53   strSel = Selection.Address
54     Application.ScreenUpdating = False
55     For Each ws In wbA.Worksheets
56        ws.Activate
57        ActiveWindow.FreezePanes = False
58        Range(strSel).Select
59        ActiveWindow.FreezePanes = True
60     Next ws
61     wsA.Activate
62exitHandler:
63     Application.ScreenUpdating = True
64     Exit Sub
65errHandler:
66     MsgBox "Could not freeze all sheets"
67     Resume exitHandler
68End Sub
69Sub S05_WidenColumnABHIJ_CD()
70   ' WidenColumns Macro
71   ' Double-click to widen columns to fit contents
72    Dim ws As Worksheet
73    For Each ws In Worksheets
74         With ws
75            .Columns("A:A").EntireColumn.AutoFit
76            .Columns("B:B").EntireColumn.AutoFit
77            .Columns("H:H").EntireColumn.AutoFit
78            .Columns("I:I").EntireColumn.AutoFit
79            .Columns("J:J").EntireColumn.AutoFit
80            .Columns("C:C").ColumnWidth = 60.67
81            .Columns("D:C").ColumnWidth = 40
82         End With
83    Next ws
84End Sub
85Sub S06_SelectJ2CellinAllWorksheets()
86    ' do this before freezing
87    Dim ws As Worksheet
88    For Each ws In ActiveWorkbook.Sheets
89       ws.Select
90       Range("J2").Select
91    Next ws
92End Sub
93Sub S08_Optional_WrapTextAllCellsInAllWS()
94    Dim ws As Worksheet
95    For Each ws In ActiveWorkbook.Worksheets
96        ws.Select
97        Cells.WrapText = True
98    Next ws
99End Sub
100Sub S09_CreateHyperlinks()
101    Dim nRow As Integer, nCol As Integer
102    nRow = 2
103    nCol = GetColumnHeadingNum("Card URL")
104    ' For all of the worksheets, convert text to hyperlinks in the
105    ' "Card URL" column from row 2 down to, but not including the end, where the end is
106    ' defined as an empty cell.
107    Dim ws As Worksheet
108    For Each ws In ActiveWorkbook.Worksheets
109        ws.Activate
110        nCol = GetColumnHeadingNum("Card URL")
111        nRow = 2
112        ws.Select
113        ws.Cells(nRow, nCol).Select
114        Do While ws.Cells(nRow, nCol) <> ""
115            ws.Hyperlinks.Add Cells(nRow, nCol), Cells(nRow, nCol)
116            nRow = nRow + 1
117        Loop
118    Next
119End Sub
120Function GetColumnHeadingNum(ColumnHeading)
121    ' S09_CreateHyperlinks() calls this function.
122    Dim nRow As Integer, nCol As Integer
123    Dim cString As String
124    nRow = 1
125    nCol = 1
126    cString = UCase(Trim(Cells(nRow, nCol)))
127    Do While cString <> ""
128        If cString = UCase(ColumnHeading) Then
129            Exit Do
130        End If
131        nCol = nCol + 1
132        cString = UCase(Trim(Cells(nRow, nCol)))
133    Loop
134    GetColumnHeadingNum = nCol
135End Function
136Sub S10_MakeFirstWorksheetActive()
137    ' return the user to the first worksheet
138    ActiveWorkbook.Worksheets(1).Activate
139End Sub