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


        Create. Review. Publish.

        Write, edit, collaborate on, and publish documents to different content management platforms.

        Get Started Now


          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 LinksWorkflow AutomationData Collection
                                Web FormsEnterpriseOnline Data Collection Tool
                                Embeddable FormsBankingBegin Data Collection
                                Interactive FormsWorkplaceData Collection App
                                CRM FormsCustomer ServiceAccessible Forms
                                Digital FormsMarketingForms for Small Business
                                HTML FormsEducationForms for Enterprise
                                Contact FormsE-commerceForms for any business
                                Lead Generation FormsHealthcareForms for Startups
                                Wordpress FormsCustomer onboardingForms for Small Business
                                No Code FormsConstructionRSVP tool for holidays
                                Free FormsTravelFeatures for Order Forms
                                Prefill FormsNon-Profit

                                Intake FormsLegal
                                Mobile App
                                Form DesignerHR
                                Mobile Forms
                                Card FormsFoodOffline Forms
                                Assign FormsPhotographyMobile Forms Features
                                Translate FormsReal EstateKiosk in Mobile Forms
                                Electronic Forms
                                Drag & drop form builder

                                Notification Emails for FormsAlternativesSecurity & Compliance
                                Holiday FormsGoogle Forms alternative GDPR
                                Form to PDFJotform alternativeHIPAA Forms
                                Email FormsFormstack alternativeEncrypted Forms

                                Wufoo alternativeSecure Forms

                                TypeformWCAG


                                    All-in-one knowledge management and training platform for your employees and customers.

                                              Create. Review. Publish.

                                              Write, edit, collaborate on, and publish documents to different content management platforms.

                                              Get Started Now





                                                                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


                                                                      • Desk Community Learning Series


                                                                      • Digest


                                                                      • Functions


                                                                      • Meetups


                                                                      • Kbase


                                                                      • Resources


                                                                      • Glossary


                                                                      • Desk Marketplace


                                                                      • MVP Corner


                                                                      • Word of the Day


                                                                      • Ask the Experts


                                                                        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 Demo

                                                                                                          Get a personalized demo or POC

                                                                                                          REGISTER NOW


                                                                                                            Design. Discuss. Deliver.

                                                                                                            Create visually engaging stories with Zoho Show.

                                                                                                            Get Started Now








                                                                                                                                • Related Articles

                                                                                                                                • Limitations:​ Forms and Fields

                                                                                                                                  To know more about forms, click here General The maximum size allowed for a multi-line and rich text field in a row is approximately 64 KB. Multi-column layouts are not supported in forms if the check-box/radio-button fields are added dynamically ...
                                                                                                                                • Import data to reports

                                                                                                                                  Zoho Creator allows you to import data from into the reports in your Creator application. Creator supports importing data from .xls, .xlsx, .xlsm, .csv, .tsv, .ods, .accdb, .mdb, .json and numbers file formats. The required file can either be stored ...
                                                                                                                                • 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 ...
                                                                                                                                • 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 ...
                                                                                                                                • Export data from reports

                                                                                                                                  Note: To optimize efficiency and security, support for XLS format has been deprecated, and instead, the XLSX format will be supported with effect from 21-March-2024. We insist you to replace any instance of .xls to .xlsx across Deluge scripts in your ...
                                                                                                                                  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