KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

CSV Read and Write #2716

Open vinothkumar opened this topic on on Jun 9, 2022 - 3 comments

vinothkumar commented on Jun 9, 2022

Store the data from CSV to MYSQL database , how can we achieve that.

Sebastian Morales commented on Jun 9, 2022

Our report can export data easily from MySQL or any data source to CSV files. The opposite situation (from CSV data source to importing to MysQL) would need more work. Pls describe your case specifically if you want our guide. Rgds,

vinothkumar commented on Jun 9, 2022

We are receiving daily total transaction into CSV file from bank , and we need to store the data into MYSQL DB then we need to fetch the data from DB and then show the report into dashboard using graphs, charts....

So please help in this case , i am using Laravel framework here

Sebastian Morales commented on Jun 10, 2022

We can only give a general guide here:

1 . Set up your report's datasource to CSV file using CSVDataSource.

2 . In your report's setup Pipe your CSV data to a datastore.

3 . In your report's view, show the datastore with Table/DataTables. Create an Import data to MySQL button inside a ( <form method='post'><button name='Import'>...</button>...</form> )

4 . When a user click Import button, check for $_POST['Import'] or $input['Import']. If there's is, run the report $report->run() so that data is piped into the report's datastore. Then get the datastore data ($report->dataStore('myDatastore')->data()) and insert them into your MySQL database.

5 . Use some check/database table/file to make sure not to import the same file several times or use SQL Insert if not exists command.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None