Batch data import to Ignition

Hello all,

I have 560 id data with single column (560x1). I need to use these data for http request therefore I thought create dataset and use with for loop. However, writing 560 lines one by one into ignition dataset feels a bit strange.

What is the best way for this operation? Can I import (read) directly from Excel?

Thank you

Use a Python script to convert the dataset into the format you want.

myDataset = []
for row in range(len(idData)):
    myDataset.append(idData[row])

Is that the kind of thing you’re looking for?

Actually no, I’m looking to import data from excel or anywhere… I’ll apply this code after when I import the data from outside to Ignition :slight_smile:

Thanks for sharing

OK but it’s still not clear. As far as I can tell -

  • You have an Excel file with 560 items in a single column.
  • You want to load these onto the gateway.
  • You want to form 560 URLs based on the uploaded data and add them to a list or dataset.

Can you use the File Upload component (Perspective)? (You haven’t tagged your original question as either Vision or Perspective. You should probably edit to add the tag.)

Actually I thought that can solve with gateway script not perspective or vision (for UI design)…

Yes, I have 560 items in a single column. I can write this items to Excel, Word, Text file etc… doesn’t matter… The important thing is how to get these items to Ignition. Probably easiest to read from excel but i’m not sure. Maybe in some way this items can be received in JSON format.

2 Likes

For a one-time job, I would just use the script console.

Excel copies data to the clipboard as TSV (tab-separated values).

It’s pretty easy to write a naive parser for that in Python and then insert the parsed values into a dataset using system.data.toDataSet.