Using the FogBugz XML API to Import Tasks from Excel


Follow

Overview


You may have a large number of tasks that you want to import to FogBugz. You can do it by using the FogBugz XML API as described below.


Prerequisites

  1. Ensure that Wget is installed in the system.
  2. Download the example Excel workbook with the UrlEncode function.

Process


For example, you have 500+ tasks in Excel with the following columns:

  • Project
  • Area
  • Title
  • Milestone
  • Assigned To
  • Priority
  • Tags
  • Case Comment

    columnstoimportfromexcel.png


To import them into FogBugz using the API, follow the steps below:

  1. Get an API token.
    Note: API tokens last until you click log off in the web interface.
  2. Add a UrlEncode function to your Excel workbook.
    Review the article on how to add a module, or custom function, to Excel for additional details.
  3. Add a Command column to the worksheet containing the tasks, with this formula:

    ="[YOUR FOGBUGZ URL]/api.asp?token="
     & "<INSERT_TOKEN>" &
     "&cmd=new" &
     "&sProject=" & urlencode(A2) & 
     "&sArea=" & urlencode(B2) &
     "&sTitle=" & urlencode(C2) &
     "&sFixFor=" & urlencode(D2) &
     "&sPersonAssignedTo=" & urlencode(E2) & 
     "&ixPriority=" & F2 &
     "&sTags=" & SUBSTITUTE(G2," ",",") &
     "&sEvent=" & urlencode(H2)

    NOTE: Replace <INSERT_TOKEN> above with the value from step 1. You can also add additional fields supported by the API, including custom fields by adding columns and the appropriate parameter to the formula.

  4. Copy and paste the contents of the Command column from your excel spreadsheet into a text file, fb.txt so that it contains all the URLs from the command column of your spreadsheet in the following format: 
    https://[your site].fogbugz.com/api.asp?token=xxxxx&cmd=new&sProject=Sample
  5. Create a batch file, fb.bat, containing the following command:

    wget --spider --no-check-certificate -i "x:\users\bob\desktop\fb.txt"

    It tells wget to hit all the URLs listed in the text file. The --spider switch tells it to ignore the results rather than saving them as a file; the --no-check-certificate switch tells it to ignore SSL certificate issues.

  6. Run the created batch file. 

Confirmation


Once you run the batch file, your cases should get created. For example:

imported_case_result.png

Do not hesitate to contact us if you have any questions!

 

 

Back to top