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 ).  

    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








                                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







                                                                                            You are currently viewing the help articles of Sprints 1.0. If you are a user of 2.0, please refer here.

                                                                                            You are currently viewing the help articles of Sprints 2.0. If you are a user of 1.0, please refer here.



                                                                                                  • 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 ...
                                                                                                  • 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 ...
                                                                                                  • 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 ...
                                                                                                  • Insert a record during an approval process

                                                                                                    Requirement   Insert a record into a form when an approval is approved or rejected. Use Case   A charity uses an application to approve the students who need their services. Any student can apply for their program, but the charity reserves their ...
                                                                                                  • Understand Record Comments

                                                                                                    What Does This Page Cover? Learn about record comments and how your application users can read comments as well as add new comments to records. Note: Record comments is only applicable to List Report. i.e. Users can only read and write comments to ...
                                                                                                    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