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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to read csv/excel file that reside on network path instead file repository

RohitKumar_Jais
4-Participant

How to read csv/excel file that reside on network path instead file repository

Hi,

I have some requirement like How to read csv/excel file that reside on network path instead File repository.

Example:

In below example you can see I want to read a csv file 'EmpDetails.csv' that reside under path 'C:/Users/NG6F868/Desktop' instead File Repository  'EDURepository' but I am getting error 'Wrapped com.thingworx.common.exceptions.InvalidRequestException: File Repository [C:/Users/NG6F868/Desktop] Does Not Exist Cause: File Repository [C:/Users/NG6F868/Desktop] Does Not Exist' when I test the service.

var params = {   
    path: 'EmpDetails.csv' /* STRING */,
columnMappings: 'FirstName,LastName,DOB' /* STRING */,
    hasHeader: true /* BOOLEAN */,
//longitudeField: undefined /* NUMBER */,
//dateFormat: undefined /* STRING */,*
    fileRepository: 'C:/Users/NG6F868/Desktop',
//fileRepository: 'EDURepository' /* THINGNAME */,
//latitudeField: undefined /* NUMBER */,
fieldDelimiter: ',' /* STRING */,
//stringDelimiter: undefined /* STRING */,
dataShape: 'EmpDetailsDataShape.csv' /* DATASHAPENAME */
};

// result: INFOTABLE
var result = Resources["CSVParserFunctions"].ReadCSVFile(params);

Is there any way to fix this issue and fulfil my requirements?

Please do the needful as soon as possible.

From,

Rohit Kumar Jaiswal

3 REPLIES 3

Try the GetCSVFile service (part of CSVParserFunctions) where instead of using a ThingWorx file repository you can supply the file URL. I don't think you can refer to a local path on your computer, though, as TW wouldn't know anything about that.

Okay,

Is there another way to read data from CSV/excel file and store data into Infotable or Datatable in Thingworx? I got stuck in my project due to this.

Please give me solution for the same.

Thank you in advance

I have requirement to read data from csv file that reside in any directory path like 'C:/Users/NG6F868/Desktop' rather than Thingworx File Repository.

Please provide solution for the same.

Top Tags