DownloadList
Downloads the contents of a Slack List as a CSV file. Supports three input modes: pass ListCsvDownloadUrl for a direct cached download (no Slack API calls); pass ListId plus a JobId from a previous run to resume polling an in-progress export; pass ListId alone to run the full asynchronous export flow (slackLists.download.start, poll slackLists.download.get, then download the resulting CSV).
Procedure-Specific Information
DownloadList retrieves the contents of a Slack List as CSV. The procedure supports three input modes, selected by which inputs are supplied. In every mode the CSV bytes are written to FileLocation, streamed to FileStream, or returned in FileData (BASE64 by default).
Direct Cached Download
If ListCsvDownloadUrl is supplied, the procedure performs a direct HTTP GET against that URL and bypasses the slackLists.download.start and slackLists.download.get endpoints entirely. Customers typically obtain this URL by selecting the column on the SlackLists table. The cached URL does not include archived rows; if archived rows are required, omit ListCsvDownloadUrl so the asynchronous flow is used instead.
EXEC DownloadList ListCsvDownloadUrl = 'https://files.slack.com/files-pri/T0123ABCD-F099C0D2RBM/csv/list?origin_team=T0123ABCD', FileLocation = 'C:\Temp\'
Asynchronous Export (Full Flow)
If only ListId is supplied, the procedure invokes slackLists.download.start, then polls slackLists.download.get until the export job reaches status COMPLETED, and finally downloads the CSV from the returned URL. Set IncludeArchived = true to include archived rows.
EXEC DownloadList ListId = 'F099C0D2RBM', FileLocation = 'C:\Temp\' EXEC DownloadList ListId = 'F099C0D2RBM', IncludeArchived = true, FileLocation = 'C:\Temp\'
Resume an Existing Export Job
If both ListId and JobId are supplied, the procedure skips slackLists.download.start and resumes polling slackLists.download.get with the supplied JobId. This is intended for two scenarios: recovering after a previous DownloadList call timed out before the job reached status COMPLETED, and consuming a JobId returned by an out-of-band call to slackLists.download.start. The JobId returned by a prior call is exposed as the JobId output.
EXEC DownloadList ListId = 'F099C0D2RBM', JobId = 'LeF1234567', FileLocation = 'C:\Temp\'
Outputs
FileData contains the CSV content when neither FileLocation nor FileStream is supplied. JobId echoes the job identifier used or returned by the asynchronous flow and is empty for the direct cached download. Status reports the final value returned by slackLists.download.get and is empty for the direct cached download. DownloadUrl contains the URL that was actually fetched. Success is true when the CSV was downloaded successfully.
Input
| Name | Type | Accepts Output Streams | Description |
| ListId | String | False | Id of the Slack List to download. Required when ListCsvDownloadUrl is not supplied. |
| ListCsvDownloadUrl | String | False | Cached CSV download URL obtained from a prior SELECT ListCsvDownloadUrl FROM SlackLists. When supplied, the procedure performs a direct HTTP GET against this URL and skips the slackLists.download.start and slackLists.download.get endpoints entirely. Cached URLs do not include archived rows. |
| JobId | String | False | Job Id returned by a previous invocation of this procedure (or by a direct call to slackLists.download.start). When supplied together with ListId, the procedure skips slackLists.download.start and resumes polling slackLists.download.get with this job Id. |
| IncludeArchived | String | False | Whether the export should include archived rows. Only honored when starting a new export job (ListId only mode). Defaults to false.
The allowed values are true, false. The default value is false. |
| FileLocation | String | False | Directory in which to save the downloaded CSV. The file name defaults to ListId.csv (or 'list.csv' when only ListCsvDownloadUrl is supplied). |
| FileStream | String | True | An output stream to write the CSV contents to. Only used when FileLocation is not supplied. |
| Encoding | String | False | Encoding to apply to FileData when neither FileLocation nor FileStream is supplied.
The allowed values are NONE, BASE64. The default value is BASE64. |
Result Set Columns
| Name | Type | Description |
| FileData | String | CSV content of the list. Populated only when FileLocation and FileStream are both empty. |
| JobId | String | Job Id returned by slackLists.download.start. Empty when ListCsvDownloadUrl was supplied. |
| Status | String | Final status reported by slackLists.download.get (for example COMPLETED, IN_PROGRESS). Empty when ListCsvDownloadUrl was supplied. |
| DownloadUrl | String | Final URL used to fetch the CSV bytes. |
| Success | String | True when the CSV was downloaded successfully. |