Is it possible to convert a csv in excel to possibly a xls file?

so do i need to change the way I coded the program to save the data?
Yes, use your Visual Basic program to run the Excel sofware, and open your CSV file.

After each change, first CLOSE the CSV file, then use your Visual Basic program to call Excel, load the CSV file, then save it as a XLS file, then CLOSE the XLS file. Now you always have an updated spreadsheet that can be opened and viewed by anyone else.

The problem with the CSV file conversion to XLS is that it may not be formatted and labeled as you need for your co-workers.

As Jesper says, a database file may be better suited for your needs. But probably your customers will prefer sticking with Excel.
 
Last edited:
EPPlus is a .NET library that will let you read/write directly to Excel files.

In Visual Studio, go to Project->Manage Nuget Packages
Search for EPPlus
When it finds it, select it in the list and click Install

If you Google EPPlus you can find examples on how to use it. Also I put a couple sample Visual Studio projects in the AdvancedHMI repository that show how to use EPPlus :

https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/SampleProjects/
 
If you have successfully written to a CSV file (it's just a text file) why don't you open it and read it to populate your datagrid?

Code:
Open "C:\XX.CSV" For Input As #1
Do While Not EOF(1)
  Input #1, intCode, intErr, intGrp, strMsg
  <if the data is what I want, put in datagrid>
  <Yada, Yada ...>
Loop
Or, you can write to an Excel file but it takes quite a bit more code.
 

Similar Topics

Due to a lack of upkeep and understanding of my predecessors, I have a PLS71 that was running V16 of Logix. I need to swap out an AENT for an...
Replies
2
Views
707
Hello, I am updating a project that uses FTView 8.1 SE Network station. During layoff due to Covid, I made the changes but it was with FTView 10...
Replies
8
Views
3,112
Hi all. I have a working program from a compactlogix platform that I have to convert to an existing SLC500. I am rewriting it manually at the...
Replies
4
Views
4,287
Hello All, I need the ability to remotely reboot a Red Lion CR3000 HMI. Due to some graphics issues when the database is updated the HMI must be...
Replies
4
Views
221
Hello The plant is running and there is no shutdown nowadays therefore I can add 1734- AENTR and its card while PLC is in Run? I do not wanna...
Replies
8
Views
348
Back
Top Bottom