By the end of this lesson your CRM will export leads to a CSV that opens cleanly in Excel, import the client's old sheet without duplicates, run live in the client's own accounts, and you will hand it over with a guide, a checklist and a fair price.
You need: the CRM with logins and RLS from lesson 4, Excel or Google Sheets to test, a copy of the client's old lead sheet · Time: 9 minutes
A CSV file is a plain-text table: one line per row, commas between cells. Every spreadsheet can open it, which makes it the right export for Kavita. But a careless CSV goes wrong in Excel in three ways:
Same leads, same Excel. The difference is how the file was written. - Phone numbers: Excel treats
919876543210as a number, shows9.19877E+11, and drops leading zeros. - ₹ and Hindi names: without a small marker at the start of the file called a BOM (byte order mark), Excel often reads UTF-8 text wrongly and shows
₹instead of₹. - Commas and quotes inside a note split it across columns unless the cell is wrapped in double quotes.
Prompt · copy it into your AI agentRead PRD.md first. Goal: Add an "Export to Excel (CSV)" button on the Leads screen. Details: - Export only the leads currently shown (search and filters applied), which RLS already limits to the logged-in user's own rows. - Columns: Name, Phone, Source, Interest, Budget (₹), Status, Next follow-up, Created, Last note. - Phone: write it as the 10 digits with a space after the fifth digit, like 98765 43210, so Excel keeps it as text. - Dates: YYYY-MM-DD. Budget: a plain whole number without commas. - Write UTF-8 with a BOM at the start, and Windows line endings (CRLF). - Quote every field in double quotes and double any double quote inside it (RFC 4180). - If a text cell starts with =, +, - or @, put a single quote in front of it so Excel never runs it as a formula. - File name: mini-crm-leads-YYYY-MM-DD.csv. Rules: Build the CSV in one small function with tests for: a note containing a comma, a note containing "quotes", a name in Hindi, and a note starting with =. Done when: I double-click the file on Windows, Excel opens it, the header shows Budget (₹), phones look like 98765 43210, and a note with a comma stays in one cell.
TipIf an old Excel still shows broken characters, open a blank workbook and use Data, then From Text/CSV, and pick 65001: Unicode (UTF-8) as the file origin.
Why?The client will judge the whole CRM by the first export they open. A file that shows
9.19877E+11instead of a phone number looks broken, even if every screen works. The formula rule also blocks "CSV injection", where a cell like=HYPERLINK(...)runs when someone opens the file.- Phone numbers: Excel treats
Log in free to read the rest of this lesson
Every lesson is free. A free account unlocks all of them and saves your progress.
Still to come in this lesson:
- Import the client's old sheet
- Go live in the client's own accounts
- Hand over with a guide and a checklist
- Price the gig
- Recap