Parse data from uploaded CSV files into fields

Parse data from uploaded CSV files into fields

Requirement  

When users upload CSV files, their data is parsed and the values are inserted into the required fields of another form.

Use case  

An order management app contains two forms, one to store purchased product details, and the other to store purchase list as CSV files. When a n admin uploads a purchase list file in the Upload Purchase List form, its data will be parsed and inserted into the respective fields of Products form.
 

Steps to follow    

1. Create two forms with the following details.
Form
Form Link Name
Field Type
Field Name
Field Link Name
Upload purchase list
Upload_purchase_list
File Upload
Purchase List
Purchase_List
Products
Products
Single Line
Product Name
Product_Name
Single Line
Unit Of Measure
Unit_Of_Measure
Number
Quantity
Quantity
Currency
Selling Price
Selling_Price
 
2. Create workflow with the following details.
 
The workflow is to be triggered when Upload purchase list form is successfully submitted, so we are selecting the Form Event as "Successful form submission".
 
3. Save the following Deluge script in the Deluge editor:
  1. //Extract the content from the uploaded input file and store in the variable fileContent as text
  2. fileContent = input.Purchase_List.content;
  3.  
  4. // Parse the file content so the rowsList variable is structured such that each of its element is a text that corresponds to a row of the input CSV file
  5. rowsList = fileContent.tolist("\n");
  6.  
  7. // Define a counter to keep track of the iteration
  8. count = 0;
  9.  
  10. // Iterate through the rowsList to parse the elements of each row. 
  11. for each  rl in rowsList
  12. {
  13.  if(count > 0)
  14.  {
  15.  
  16. // Split elements of the row and convert into a list
  17.  elementsList = rl.tolist(",");
  18.  
  19. // Add record into the Products form
  20. response = insert into Products
  21. [
  22.  Added_User = zoho.loginuser
  23.  Product_Name = elementsList.get(2)
  24.  Unit_Of_Measure = elementsList.get(3)
  25.  Quantity = elementsList.get(4)
  26.  Selling_Price = elementsList.get(3)
  27. ]; 
  28. }
  29.  
  30. // Increment the counter at the end of each iteration
  31.  count = count + 1;
  32. }

See how it works  

 

Points to note  

  • The Deluge script provided in this tutorial is specific to the CSV files whose rows are separated with new lines and the first row contains header of the columns, which are in the order of Product Name, Unit Of Measure, Quantity, and Selling Price. Using this script for a CSV file of different format may not work as expected.

    Please check the attachments for the sample file on which the provided Deluge script works.

  • This tutorial works best on files that usually contain only text values ( for example, .txt or .csv ).  

    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION






                          Quick Links Workflow Automation Data Collection
                          Web Forms Enterprise Begin Data Collection
                          Interactive Forms Workplace Data Collection App
                          Encrypted Forms Customer Service Accessible Forms
                          Digital Forms Marketing Forms for Small Business
                          HTML Forms Education Forms for Enterprise
                          Contact Forms E-commerce Forms for any business
                          Lead Generation Forms Healthcare Forms for Startups
                          Wordpress Forms Customer onboarding Order Forms for Small Business
                          No Code Forms Construction RSVP tool for holidays
                          Free Forms Travel
                          Prefill Forms Non-Profit

                          Intake Forms Legal
                          Mobile App
                          Form Designer HR
                          Mobile Forms
                          Card Forms Food Offline Forms
                          Assign Forms Photography
                          Mobile Forms Features
                          Translate Forms Real EstateKiosk in Mobile Forms
                          Electronic Forms

                          Notification Emails for Forms Alternatives
                          Holiday Forms Google Forms alternative 
                          Form to PDF Jotform alternative





                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                              • Related Articles

                                                                                                              • Extract contents of a ZIP file and email the extracted files

                                                                                                                Requirement   Use Deluge to extract a ZIP file and email the extracted files with the click of a button. Use Case   An HR management application contains three forms: Add Employee, Employee Payslips, and Download My Payslips. The Add Employee form ...
                                                                                                              • Check for the type of the file uploaded

                                                                                                                Requirement Only allow the file upload field to accept file types PDF, XLS, or XLXS. Display an alert message when any other file type is detected. Use case A restaurant app contains a form to store supplier receipts as files. When an admin uploads a ...
                                                                                                              • Add data to a different application

                                                                                                                Requirement Automatically add a record to a form of one application when a record is added in a different application. Use Case A Zoho creator account has two applications: Contact Management and Order Management. All the customer details maintained ...
                                                                                                              • Add subform rows with dynamic data from another subform

                                                                                                                Requirement             Automatically add rows to a subform and populate it with dynamic data fetched from another subform. Use Case   A form named Orders Database contains customer details and their frequent orders in a subform. We have another ...
                                                                                                              • File download

                                                                                                                This API service lets you manage the different functionalities in a report. File download Methods downloadMedia(from:completionHandler:)This downloads the files in the image, file, audio, video, and signature fields. ...
                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources