Page 1 of 1
How to upload and parse csv files
Posted: Thu Apr 24, 2025 10:04 am
by nadir
Hello,
I would like to upload and parse csv files. I tried to use input object of type file but it gave a javaScript error. I have posted the error in a previous post. Please provide some guidance on how to implement this feature. I did not find any helpful topics in the forum
Thanks,
Nadir Latif
Re: How to upload and parse csv files
Posted: Thu Apr 24, 2025 10:56 am
by kev1n
Hi Nadir,
I've responded to your initial post regarding the JavaScript error — feel free to check there for more details.
In this thread, it sounds like your main goal is to upload and parse CSV files after resolving the upload issue. Could you please clarify what kind of parsing you're looking to do? For example, are you aiming to display the data in a table, insert it into a database, or process it in some other way?
Once I understand your use case a bit better, I'll be happy to guide you through the implementation.
Re: How to upload and parse csv files
Posted: Thu Apr 24, 2025 11:24 am
by nadir
Hi Kevin,
The CSV file contains attendance records. I want to parse the uploaded CSV file, process the data and then store the data in a database table.
Re: How to upload and parse csv files
Posted: Thu Apr 24, 2025 11:48 am
by kev1n
There's a function called nuImportUsersFromCSV() in nucommon.php that demonstrates how to process a CSV file and import its data into a database table.
You can tell ChatGPT (or any other AI) what your CSV file looks like—such as the headers and a few sample rows—and also describe your table schema, including column names and types. Based on that, it can help you adapt the code to fit your specific case.
Feel free to ask if you need help or have specific questions!
Re: How to upload and parse csv files
Posted: Fri May 02, 2025 8:07 am
by kev1n
Just checking in—was that info about nuImportUsersFromCSV() helpful? Were you able to get your CSV data imported into the database successfully? Let me know if you ran into any issues or still need a hand!
Re: How to upload and parse csv files
Posted: Fri May 02, 2025 8:11 am
by nadir
Yes I was able to get the CSV data imported. Thanks