A Beginner API Project: Pulling Profile Data Into a Spreadsheet
A small first project for people learning to code - send a request to a REST API, read the JSON that comes back and write the fields you need into a CSV file you can open in any spreadsheet app.

Tutorials about APIs often stop at "here is a request, here is the response". The concepts click much faster when you build something you can actually use. This project does exactly that: you will send requests to a REST API, pick a few fields out of the JSON it returns and save them as a CSV file that opens in Excel, Google Sheets or LibreOffice. It takes an afternoon and teaches the pattern behind most real integrations.
What you need
- Python 3 installed, plus the
requestslibrary (pip install requests). - A code editor and a terminal.
- An API that returns data you find interesting, and an API key for it.
If APIs are completely new to you, read our API examples for beginners first; it explains requests, endpoints and status codes in plain words.
Choosing a data source
Any JSON API works for practice. Professional profile data is a good choice because the records are easy to understand: a name, a headline, a current company, a location, a list of past roles. For this walkthrough we use the Linkedin Profile API from EnvoAPI, which returns public profile details as JSON and gives new accounts free credits, enough for a learning project. Read its documentation for the exact endpoint and parameter names; the steps below show the general shape that applies to most REST APIs.
Step 1: Keep your key out of the code
Never paste an API key directly into a script you might share. Store it in an environment variable instead:
export API_KEY="your-key-here" # macOS / Linux
setx API_KEY "your-key-here" # Windows (open a new terminal afterwards)
Step 2: Make one request and look at the response
import os, requests
API_KEY = os.environ["API_KEY"]
BASE_URL = "https://example-api-base-url" # take this from the provider's docs
resp = requests.get(
f"{BASE_URL}/profile",
params={"url": "https://www.linkedin.com/in/some-public-profile/"},
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=30,
)
print(resp.status_code)
print(resp.json())
Run it and study the output. Which keys hold the name, the headline, the company? Is the list of positions nested inside another object? Getting comfortable reading raw JSON is half the skill.
Step 3: Pick the fields you want
def to_row(data):
return {
"name": data.get("full_name", ""),
"headline": data.get("headline", ""),
"company": data.get("company", ""),
"location": data.get("location", ""),
}
Using .get() with a default means a missing field produces an empty cell instead of crashing the script. Adjust the key names to match what you saw in Step 2.
Step 4: Loop and write a CSV
import csv
profiles = [
"https://www.linkedin.com/in/first-public-profile/",
"https://www.linkedin.com/in/second-public-profile/",
]
with open("profiles.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=["name", "headline", "company", "location"])
writer.writeheader()
for url in profiles:
r = requests.get(f"{BASE_URL}/profile", params={"url": url},
headers={"Authorization": f"Bearer {API_KEY}"}, timeout=30)
if r.ok:
writer.writerow(to_row(r.json()))
else:
print("Skipped", url, r.status_code)
Open profiles.csv in your spreadsheet app and you have a tidy table built entirely by your own code.
Step 5: Make it a little more robust
- Rate limits: add
time.sleep(1)between requests if the docs mention limits. - Errors: log failed URLs to a separate file so you can retry them.
- Input: read the list of URLs from a text file instead of hard-coding it.
If your source data starts life in PDFs rather than an API, our guide to turning PDFs into Excel sheets covers that route.
A word on responsible use
Profile data describes real people. Use it for a clear purpose, keep only what you need, and do not publish or share the spreadsheet. Learning projects are a good place to build that habit early.
Where to go next
Once this works, try swapping the CSV for a small SQLite database, adding a command-line argument for the input file, or scheduling the script to run weekly. Each step is a new concept, built on a project you already understand.
Worth a second look
EducationHTML vs CSS: What Each One Does on a Web Page4 min
Real EstateMortgages in Australia Explained: Complete Breakdown for First-Time Homebuyers3 min
NewsPlanning a Day Trip from Boston: Best Nearby Cities and How to Build an Efficient Route3 min
EducationWhat Is Pseudocode? How to Write It, With Simple Examples4 min


