Sending Upload to Gemini
Sending upload to gemini
Now that you’ve combined all of your syllabus content into a single Markdown string, you’re ready to send it to an AI model — in this case, Google Gemini — to extract your assignments and return them in a clean CSV format.
Step 1: Get Your Gemini API Key
To use Gemini, you’ll need to create an API key from Google’s developer console.
- Go to https://ai.google.dev/gemini-api/docs/api-key
- Sign in with your Google account
- Click Create API Key
- Copy the key and store it safely — we’ll use this in our fetch request
Just like we did with Mistral, you should store this key in your hidden.js file:
1
const geminiApiKey = "your-gemini-api-key-here";
TASK 4: Implement
async function JsonToCSV(markdownExport)toPOSTthe combined markdown to Gemini’sgenerateContentendpoint and request assignment extraction in CSV format.
NOTE: The more specific and clear your prompt is, the better your results will be. Use
POSTto the Gemini endpoint (https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent?key=YOUR_API_KEY), instruct Gemini on exact column headers (Due Date, Class, Assignment Name, Assignment Type, Checkbox), and request pure CSV data without markdown ticks. Google often updates available free tier models; check Google AI Pricing if you need to substitute another free tier model.