Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi ,
I am trying to read data from CSV using ReadCSVFile from CSV Parser Extension snippets.
I am getting below error while am trying to read data.
Error executing service importUserNames. Message :: Unable To Open [TestName.csv] in [SystemRepository] : Index: 2, Size: 2 car- See Script Error Log for more details.
Can someone help me in resolving this issues.
Here is service code and attaching sample CSV am trying to upload.
var params = {
path: fileName /* STRING */,
columnMappings: 'Name;FullName;Password' /* STRING */,
hasHeader: true /* BOOLEAN */,
fileRepository: "SystemRepository" /* THINGNAME */,
fieldDelimiter: "," /* STRING */,
dataShape: "ImportUsers" /* DATASHAPENAME */
};
// result: INFOTABLE
var result = Resources["CSVParserFunctions"].ReadCSVFile(params);
for(var i=0;i<result.length;i++)
{
var params = {
password: result[i].Password /* STRING */,
name: result[i].Name /* STRING */,
description: result[i].FullName /* STRING */
};
// no return
Resources["EntityServices"].CreateUser(params);
};
1. The mentioned error in the details is not giving more information. Can you provide more details from Script error log?
Refer to these community posts:
Also, these articles may be helpful for you
1. https://www.ptc.com/en/support/article?n=CS255612
2. https://www.ptc.com/en/support/article?n=CS294337
3. https://www.ptc.com/en/support/article?n=CS211965
4. https://www.ptc.com/en/support/article?n=CS240648
Thanks,
Vibhuti
Hi Vibhuti,
Thanks for your help, this issue is solved.Problem is with CSV file format.
Regards
Lakshmi.