Generating Clean Flutter Localizations from Excel
A simple sharing of experiences when working with Excel for Flutter localization, the small challenges that often appear, and how excel_translator can help make the workflow cleaner with multi-sheet support, string interpolation, and type-safe Dart code.

Hi everyone. I want to share a small experience that changed how I handle localization in Flutter projects.
In this article, I want to share a small story from experience building Flutter apps that support multiple languages, and how that led to discovering a package called excel_translator. This is not a theoretical idea. It comes from real problems that often appear in real projects.
If you have ever worked on localization in Flutter, especially with a translation team that uses Excel, you might relate to this.
But the real challenge was not Excel itself. The real challenge was connecting Excel with Flutter localization in a clean way.
When Excel Meets Flutter Localization
In several projects, the translation team always preferred using Excel. And honestly, Excel is very comfortable for them. They can see all texts clearly, edit easily, use filters, copy and paste between sheets, and work much faster than editing JSON or ARB files. From the translator’s point of view, Excel is perfect.
The problem starts when that Excel file needs to be used in Flutter. This is where things slowly become messy.
At First, I Used Other Packages
Before finding the right solution, several existing tools were tried.
Package A: Can generate from Excel, but...
This package could read Excel and generate Dart localization. It looked promising. But after using it in a real project, a big problem appeared: there was no support for string interpolation.
For example:
Welcome {name}
Total price: {price}
The package could not convert this into a Dart function like:
loc.welcome(name: 'John');
Instead, the generated result was just a plain string. To make it work, the variables had to be manually replaced in the code every time.
final message = loc.welcome
.replaceAll('{name}', userName)
.replaceAll('{price}', totalPrice.toString());
This quickly became repetitive, error-prone, and hard to maintain, especially when many strings required parameters. Localization started to add extra work instead of reducing it.
Package B: Supports interpolation, but...
Another package supported interpolation, but then another serious problem appeared: it did not support multi-sheet.
This means all translations must be placed in one single sheet. For small projects, this is fine. But for large projects, the Excel sheet becomes extremely long, with thousands of rows that are hard to search and hard to manage. You cannot separate translations per page or per feature, and the translation team also started to struggle because everything was mixed together.
The Real Need That Was Missing
From these experiences, it became clear what was actually needed:
- Excel must be the source of truth
- It must support string interpolation
- It must support multi-sheet
- Translations must be separable per feature or per page
- The result must be type-safe Dart code, not just JSON
Eventually, a package was found that provides all of these in one place: excel_translator.
What Does excel_translator Do?
excel_translator reads your Excel file and generates clean, type-safe Dart localization code.
Multi-sheet support
You can create sheets like login, home, profile, and buttons. Your Excel becomes much cleaner, and translators are happier because they can focus on one part at a time.
String interpolation directly from Excel
In Excel, you can write:
Welcome {name}
Total: {price}
And in Dart, it automatically becomes:
loc.login.welcome(name: 'John');
loc.cart.total(price: 100);
No manual coding is required.
Localization structure follows the sheet structure
If your sheet is named login, then in Dart you get:
loc.login.title;
loc.login.welcome(name: 'John');
Very clean and very easy to find in the IDE.
Example Excel Structure
Sheet: login
| key | en | id |
|---|---|---|
| title | Login | Masuk |
| greet | Welcome {name} | Selamat datang {name} |
Sheet: buttons
| key | en | id |
|---|---|---|
| save | Save | Simpan |
| cancel | Cancel | Batal |
Practical Quick Start with excel_translator
Here is a minimal setup to try excel_translator in your project.
1. Install the package
Add this to your pubspec.yaml:
dependencies:
excel_translator: ^2.1.1
2. Create your localization file
You can use Excel, CSV, or ODS. Excel is recommended for larger projects.
| key | en | id |
|---|---|---|
| app_title | My App | Aplikasi Saya |
| welcome_message | Welcome {name}! | Selamat datang {name}! |
You can also split by feature using multiple sheets like login and buttons.
3. (Optional) Configure in pubspec.yaml
excel_translator:
excel_file: assets/localizations.xlsx
output_dir: lib/generated
class_name: AppLocalizations
4. Generate the localization code
dart run excel_translator
Or:
dart run excel_translator assets/localizations.xlsx lib/generated
5. Use the generated code
Text(AppLocalizations.of(context).login.title);
final loc = AppLocalizations.english;
print(loc.buttons.submit);
print(loc.login.welcomeMessage(name: 'John'));
6. Use localization without BuildContext
You can even use it inside repositories or services:
final message = AppLocalizations.current.errors.invalidUser;
throw Exception(message);
Why This Helps a Lot in Real Projects
In real projects, translators use Excel, projects have many features, strings often need parameters, ARB or JSON files quickly become hard to read, and long sheets are difficult to manage.
With this approach, Excel stays comfortable for translators and Dart stays comfortable for developers. Both can work together without causing problems for each other.
Closing
This approach solves many of the problems that usually appear when Excel is used for Flutter localization.
If you have ever felt that Excel is great for translations but painful to use in Flutter, there is a good chance this package can improve your workflow.