https://github.com/hsmnzaydn/easy-csv
Creates csv file for android
https://github.com/hsmnzaydn/easy-csv
android csv csvcreator easy-to-use
Last synced: 15 days ago
JSON representation
Creates csv file for android
- Host: GitHub
- URL: https://github.com/hsmnzaydn/easy-csv
- Owner: hsmnzaydn
- License: apache-2.0
- Created: 2018-11-20T19:44:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-11-30T12:54:17.000Z (4 months ago)
- Last Synced: 2025-12-02T16:56:54.129Z (4 months ago)
- Topics: android, csv, csvcreator, easy-to-use
- Language: Java
- Homepage:
- Size: 366 KB
- Stars: 44
- Watchers: 1
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: License.txt
Awesome Lists containing this project
README
# easy-csv
Creates csv file for android

## Download
**Add it in your root build.gradle at the end of repositories:**
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
**Add the dependency**
dependencies {
implementation 'com.github.hsmnzaydn:easy-csv:1.0.0'
}
## Use Steps
**Step 1: Create EasyCsv Object**
``` java
EasyCsv easyCsv = new EasyCsv(MainActivity.this);
```
* to output the file in diffrent charset create EasyCsv object with below constructer
``` java
EasyCsv easyCsv = new EasyCsv(MainActivity.this, StandardCharsets.YOUR_CHOOISE);
```
**Step 2: Create your headerlist and datalist**
``` java
List headerList = new ArrayList<>();
headerList.add("Name.Surname.Age-");
List dataList = new ArrayList<>();
dataList.add("Serkan.Ozaydin.23-");
```
**Step 3: Select separators for column and line**
``` java
easyCsv.setSeparatorColumn(".");
easyCsv.setSeperatorLine("-");
```
**Step 4: Create CSV file**
``` java
/**
* @param fileName Name of the file to be created
* @param WRITE_PERMISSON_REQUEST_CODE EasyCsv request runtime permission for Write permission to user. When user "Accept" or "Decline" for you can handler
*/
easyCsv.createCsvFile(fileName, headerList, dataList, WRITE_PERMISSON_REQUEST_CODE, new FileCallback() {
@Override
public void onSuccess(File file) {
}
@Override
public void onFail(String err) {
}
});
```
**Step 5 (Optional): Save to a custom path (e.g., Downloads folder)**
``` java
// Get the Downloads folder path
String downloadPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
/**
* @param filePath Custom path where the file will be saved
* @param fileName Name of the file to be created
* @param WRITE_PERMISSON_REQUEST_CODE EasyCsv request runtime permission for Write permission to user. When user "Accept" or "Decline" for you can handler
*/
easyCsv.createCsvFile(downloadPath, fileName, headerList, dataList, WRITE_PERMISSON_REQUEST_CODE, new FileCallback() {
@Override
public void onSuccess(File file) {
}
@Override
public void onFail(String err) {
}
});
```
# Changelog
* 3/5/2020
— you can output the file with chosen Charset like UTF-8 and UTF-16 etc ...
# License
Copyright 2018 Huseyin Serkan Ozaydin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.