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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to update already created excel/CSV file

G_U
11-Garnet
11-Garnet

How to update already created excel/CSV file

Hello Experts,

             

Application Requirement : To fetch excel or CSV file in thingworx as template, Update cells or rows in file and save with new name ( so that my template will be there for every next operation)

 

 

Current Status:  I want to only update excel/CSV file but i am unable to find any solution for same, 

 

I have tried CSV Parser function in thingworx to Read and write file but during write operation it completely overwrites previous data.

 

Please suggest solution for same.

 

I am using Thingworx 9.3.2

 

5 REPLIES 5

I believe, there is no direct approach to do.

Try to create an extension and consume the excel file as temple and so on.

nmutter
16-Pearl
(To:G_U)

The CSVParser will be the best thing to use. I do not understand what your issue is with it. You may want to share code.

 

In theory you want to:

1. read the template .csv (ReadCSVFile)

2. Modify what you need to modify

3. Save modification with new filename(SaveCSVFile)

G_U
11-Garnet
11-Garnet
(To:nmutter)

Hello nmutter,

                  I have tried to use CSV parser , but by using that i can Read or write CSV files only and do not have option to update or modify file.

 

Read CSV file is working fine for me. I can see values of file in infotable output of service

 

While writing CSV file, complete file gets overwritten by data provided in infotable while writing CSV file.

 

Please find below Sample information to get more detailed view on requirement,

G_U_1-1664166675177.png

 

 

I want above mentioned file as Template, Where Headings should be similar for every file and Area highlighted in blue should get values from thingworx infotable.

 

So in above case I need to have control to update cells of files ,not the complete sheet which only follows infotable structure to write file.

 

Please let me know if you need more information in it.

 

Thanks. 

 

 

 

VladimirRosu
19-Tanzanite
(To:G_U)

Hi @G_U ,

I believe you need to clarify for us some points in order to be able to effectively help you:

  1. You mentioned CSV or EXCEL. They are different formats, and then you speak about "area highlighted in blue" which is something a CSV file does not support. With a CSV you will not be able to obt
  2. From a programming perspective, what stops you reading the CSV, modifying only the cells you need to modify, then writing back your modified infotable as suggested by the members above? Looking from a different angle, why you need to have the capability to update on the disk if you can achieve the same thing faster by updating the full content in memory, then writing on disk?
PEHOWE
17-Peridot
(To:G_U)

@G_U

If you are open to creating an Extension, you can use the libraries provided from the Apache Software Foundation, Apache POI library. This library will give you the ability to create, read and modify Excel file types as well as CSV.

 

 

Announcements


Top Tags