Support > Forums > OpenBots Studio > Feature Request: CSV command to import from file to DataTable

Feature Request: CSV command to import from file to DataTable

Karl Chester

  • Reporter
  • Calender Icon December 26,2021 at 12:06 AM

I would like to import a text CSV file and have this create a datatable in an obscript. Another option would be to have a 'datatable delimited string import/convert' command available under the Data Manipulation section.

I think it's possible to create a datatable and then import each line from the CSV into it, but this is such a common task for developers who need to work outside of Excel and need an easy way to import CSV files.

Or maybe I'm missing an obvious way to do this?

This forum has 317 topics, 687 replies, and was last updated 4 months ago by Nataly Alvarado...

Karl Chester

  • Participant
  • Calender Icon December 30,2021 at 7:32 PM

In addition to being able to convert CSV data into a datatable, I can see the need to convert text to and from supported OpenBots formats: XML, JSON, and Dictionary. This would allow me to import raw text from a file of any text type, and then convert this to these supported formats within OpenBots, without having to write a separate method/task. These conversion commands are pretty important.

Lakshmi Sukumar

  • Participant
  • Calender Icon December 28,2021 at 8:08 PM

Hello!

You can import csv files to a datatable using the Excel commands. You'll need to point to the .csv file in the Excel Create Application command and use the Excel Get Range command to save the output into a datatable variable. Of course, as you mention this will require you to have Excel installed on your machine or access it through the Microsoft 365 office.

The other option would be to use the Read Text File command to extract the csv as plain text, and use string manipulation to populate the information into a datatable. However, this can be a tedious task and as you mention, this is a common task among developers. I will take your suggestions to the development team, to package this action into a command, to simplify the development process.

Thanks again for the suggestion!

You are not authorized to reply, please click here to login and add your reply to this topic.