You can easily export your tracking numbers for past shipments by running a Shipping Report.
From there, you can run your report by following the steps to create a custom report.
Once you download your Shipping Report, the shipment information will show on the spreadsheet. This will contain the tracking number if included for your shipment type.
The tracking number will have a ' before the tracking number. This is because spreadsheets will automatically truncate this number. If you would like to omit this, just select the column, then do CTRL+F (for Windows) or COMMAND+F (for Mac) and "Find" ' and leave the "Replace" value blank.
This will cause the numbers to truncate. To change this, change the column format from "General" or "Number" to "Text".