cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Unable to open file using CSV Parser ReadCSVFile method

Lakshmit
9-Granite

Unable to open file using CSV Parser ReadCSVFile method

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

};

 

2 REPLIES 2

@Lakshmit 

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:

Community Post 1

Community Post 2

 

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

Lakshmit
9-Granite
(To:vangne)

Hi Vibhuti,

Thanks for your help, this issue is solved.Problem is with CSV file format.

 

Regards

Lakshmi. 

Announcements


Top Tags