Skip to content
Field Guide
Coming soon. This video isn't public yet. Everything it says is in the transcript below.

A report chart, in Excel

A ranked bar chart in Excel that refreshes itself.

2:35 Captions in the video Python Excel Recorded 16 October 2026

Lesson 1 of 5 · Present it in the tools you use Next: An animated chart, in Flourish

Try it yourself

  • Python, after import undata as un
    table = un.latest("undata/sdg/EG_ACS_ELEC", "Western Africa")
    un.save(table, "electricity.xlsx")
  • Python, after import undata as un
    print(un.powerquery("undata/sdg/EG_ACS_ELEC", "Western Africa"))

    In Excel: Data › Get Data › From Other Sources › Blank Query. Open the Advanced Editor, paste the code, then Close & Load. Refresh All brings in new values.

Remember: Sort, declutter, one colour with a purpose, the finding as the title, the source underneath.

Transcript

  1. 0:00 A chart in a report has two jobs: make one point, and let the reader check it. Here is how to build one in Excel, from official UN data, in about five minutes.
  2. 0:10 This is where we are going: a ranked bar chart in the style of the World Bank’s Atlas of the SDGs. The title states the finding. One colour marks the country the report is about, Nigeria. And the source sits right underneath, with the one territory that has no data.
  3. 0:26 Two lines of Python fetch the data. un.latest takes each country’s most recent value for electricity access, SDG seven point one point one, across Western Africa. un.save writes it to an Excel file, and tells you, in plain words, which place had no value.
  4. 0:43 Open it, and the data is ready to chart: country, year, value and unit, with the source on every row. The sources sheet holds the full citation, ready to paste. And the no data sheet names Saint Helena, instead of showing a zero.
  5. 0:57 Select the country and value columns, and insert a bar chart. This is Excel’s default. It is correct, and it says nothing. Move one: sort smallest to largest, so the longest bar sits on top. Two: delete the gridlines and the axis, and label the bars instead. Three: make every bar grey, then colour only the country you are writing about. Four: write the finding as the title, with the unit, the year and the benchmarks underneath. Five: paste the source line from the sources sheet.
  6. 1:31 Same data, same software. The difference is five decisions, and every one of them is for the reader: what to look at first, what it means, and where it came from.
  7. 1:42 Next quarter the numbers will change. Rather than start again, ask undata for Power Query code. It writes a query that fetches the same indicator for the same countries, and drops a place with no data instead of filling it with zero. We sent the query’s request to the live service, and it returned 391 values.
  8. 2:00 In Excel, go to Data, Get Data, From Other Sources, Blank Query. Open the Advanced Editor and paste the code. Close and Load puts the values in a table. From then on, Refresh All brings in whatever the agencies have published since, with no Python involved.
  9. 2:18 Swap Western Africa for your region. Swap electricity for the indicator in your mandate. The five moves stay the same.
  10. 2:25 A chart that makes one point, and shows where it came from. Next: a chart that moves, in Flourish.

Go deeper

↑ ↓ to move · Enter to open · A match inside a video opens the lesson at the moment the words are said.