Flutter - Create an Excel Sheet and Save the File in Device
Last Updated :
24 Apr, 2025
A spreadsheet is a computer program that captures, displays, and manipulates data arranged in rows and columns. Sometimes we have data but that is either in json or in the list and we have to convert data to an excel sheet and store it in the user's device. So that he/she can easily access it, you must have used the excel sheet earlier. So let's make the make excel sheet in flutter and download it to our device.
Step By Step Implementation
Step 1: Create a New Project in Android Studio
To set up Flutter Development on Android Studio please refer to Android Studio Setup for Flutter Development, and then create a new project in Android Studio please refer to Creating a Simple Application in Flutter.
Step 2: Add this package syncfusion_flutter_xlsio to your project
Dart
dependencies:
syncfusion_flutter_xlsio: ^20.4.50-beta
Step 3: To make an excel sheet we need some data in json form or a list
We will take this data to convert it into an excel sheet
[
{
"title": "How to Add .env File in Flutter?",
"link": "https://www.geeksforgeeks.org/how-to-add-env-file-in-flutter/"
},
{
"title": "Flutter - Select Single and Multiple Files From Device",
"link": "https://www.geeksforgeeks.org/flutter-select-single-and-multiple-files-from-device/"
},
{
"title": "Autofill Hints Suggestion List in Flutter",
"link": "https://www.geeksforgeeks.org/autofill-hints-suggestion-list-in-flutter/"
},
{
"title": "How to Integrate Razorpay Payment Gateway in Flutter?",
"link": "https://www.geeksforgeeks.org/how-to-integrate-razorpay-payment-gateway-in-flutter/"
},
{
"title": "How to Setup Multiple Flutter Versions on Mac?",
"link": "https://www.geeksforgeeks.org/how-to-setup-multiple-flutter-versions-on-mac/"
},
{
"title": "How to Change Package Name in Flutter?",
"link": "https://www.geeksforgeeks.org/how-to-change-package-name-in-flutter/"
},
{
"title": "Flutter - How to Change App and Launcher Title in Different Platforms",
"link": "https://www.geeksforgeeks.org/flutter-how-to-change-app-and-launcher-title-in-different-platforms/"
},
{
"title": "Custom Label Text in TextFormField in Flutter",
"link": "https://www.geeksforgeeks.org/custom-label-text-in-textformfield-in-flutter/"
}
]
Step 4: Create a button from where you can create excel and download it in
Dart
floatingActionButtonLocation:
FloatingActionButtonLocation.miniCenterFloat,
floatingActionButton: FloatingActionButton.extended(
onPressed: () {},
label: const Text("Create Excel sheet"),
),
Step 5: ImportÂ
Dart
import 'package:syncfusion_flutter_xlsio/xlsio.dart' as xcel;
Step 6: Create an instance workbook and worksheet for 1st
Dart
final xcel.Workbook workbook = xcel.Workbook();
final xcel.Worksheet sheet = workbook.worksheets[0];
Step 7: Create a heading for the excel sheet in the first rows
Dart
sheet.getRangeByIndex(1, 1).setText("Title");
sheet.getRangeByIndex(1, 2).setText("Link");
Step 8: Now we will insert data into an excel sheet
Dart
for (var i = 0; i < myList.length; i++) {
final item = myList[i];
sheet.getRangeByIndex(i + 2, 1).setText(item["title"].toString());
sheet.getRangeByIndex(i + 2, 2).setText(item["link"].toString());
}
Step 9: Save the excel sheetÂ
Dart
final List<int> bytes = workbook.saveAsStream();
FileStorage.writeCounter(bytes, "geeksforgeeks.xlsx", context);
Step 10: Dispose the workbook that you had created
Dart
Step 11: Download the excel file downloads folder
Note: Add this permissions (For android)
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>Â
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Output:
1. Button to be clicked to create excel of data shown and save file
Â
2. Snackbar after successfully saving the file in the device
Â
3. File saved in the download
Â
4. Saved File
Â
Similar Reads
Flutter - Select Single and Multiple Files From Device
We will explore how to select single, or multiple files from our device with different conditions. Sometimes it happens that we want to select only a single type of file or with a fixed extension. If you are looking for the same just read the article till the end. Step By Step Implementation 1. Crea
6 min read
Difference Between Isolates and Compute in Flutter
When developing mobile applications with Flutter, it's important to consider performance and responsiveness to ensure a smooth user experience. Two tools that can be used to achieve this are Flutter Isolates and Flutter Compute. Both tools allow for parallel processing, but they have some difference
4 min read
Flutter - Create Interactive Event Calendars
This article outlines how to integrate event management functionality into a Flutter project, with a focus on adding and displaying events within a calendar interface. We will utilize the GetX package for routing and various utilities; alternative solutions are also available. The get_cli tool will
9 min read
How to Build and Release Flutter Application in Android Device?
Flutter is Googleâs Mobile SDK to build native iOS and Android, Desktop (Windows, Linux, macOS), Web apps from a single codebase. When building applications with Flutter everything towards Widgets â the blocks with which the flutter apps are built. They are structural elements that ship with a bunch
2 min read
Creating a Finance Tracker Application in Flutter
Developing a new tracker for finance is a good practice to improve your skills and build a helpful application. Through Flutter, an open-source UI toolkit developed by Google, it is possible to design for iOS/ Android, web, and desktop. Here you will find out the recipe of how to create a finance tr
6 min read
How to Build a Flutter App to Display Device Details?
Here we are going to build an android application using flutter that displays device information on which it is running. To display information about the device we are going to use a package called device_info_plus. Create Flutter Project: Now remove all the existing code and remove the test folder
5 min read
Flutter - Deleting Data On The Internet
In this article, we will explore the process of deleting data on the internet. Before deleting data on the internet, we will fetch the data first and then will delete the data. Steps to implement Deleting Data on the InternetStep 1 : Create a new flutter applicationCreate a new Flutter application u
4 min read
Flutter - Extract Data From an Image to Text
Google ML kit provides many features, one of them is Image to Text Extraction, through which we can simply extract text from an image. To extract text from the image first we need to take an image as input either from the gallery or camera for which we will use 'image_picker: ^1.0.4' (dependency fro
3 min read
Flutter - Read, Write and Override File Locally to Disk
In many cases, we need to save files locally so that we can read and write them while the device is offline. For example, we might need to persist data across the app. To save files to disk on mobile or desktop apps, we need to add package path_provider to our project. There are Four Steps to Read a
8 min read
Flutter - Animate Items in List Using AnimatedList
The AnimatedList widget in Flutter is used to create a list that automatically animates changes to its items. It's particularly useful when you want to add or remove items from a list with smooth animations. In this article, we are going to see how the list is animated when an item is deleted or add
5 min read