As the title describes, I have a data table, called Dictionary, that I build out using build data table activity. Upon building it, I then want to insert the data into the datatable to have it preserve the data in between runs from an excel file. However, I don’t want to manually insert the data as it is several thousand rows long. How can I automate the data table population?
Hi @jacob.porter u can use add datarow activity to inser the row into the datatable
Well I certainly can do that, but I still have to read in the excel file each time it runs, I’m interested in storing the data from the excel file in a data object permanently. Client wants us to eliminate as much external baggage, i.e. an extra excel file.
You can have a look on UiPath Data Service feature
You can read the datatable from excel once, then write the datatable (json formatted) to a text file. You need to import Newtonsoft.Json first in order to convert datatable to json. By doing this you can kind of store it permanently
Then the next time you run, you just need to read from the same text file, and convert the text back to a datatable. This way is a lot faster than reading from the excel again.
I would second the approach proposed by @jack.chan.
If the customer continues insiting on no files stored locally, You can use the output Json string and save it as an asset in the orchestrator.
When running the next time, you can perform the required operations of the datatable, convert to json string and then use
Set Assetactivity before ending the process.
Extra level of data protection - Since the asset value being stored is in String format you can encrypt it before setting it as an asset. This will ensure that the asset value is complete jibbrish in orchestrator and only an encrypted text is shown. (Here you can use UiPath Cryptography Activities Pack to Encrypt or Decrypt strings.
So in this scenario, next time you run the process, you can
- Get Asset,
- Decrypt asset using a customer choosen encryption key,
- Convert it to a datatable
- Modify the datatable,
- Convert to json,
- Encrypt the Json string and
- Set Asset
I am sure your customer will be pleased with these multiple safegaurds and for not needing to store an extra file in the project folder.
Hope this helps!