lgnihlman Posted January 5, 2010 Share Posted January 5, 2010 I need to display data from a .csv file but I don't know how to do it. This is an example of the file, each line ends with CRLF. 2010-01-05 10:46;0;0;0;1;0;0;0;0;0 2010-01-05 11:42;0;1;0;0;0;0;0;0;0 2010-01-05 12:14;0;0;0;0;1;0;0;0;0 The goal is to read the data and display it in a table with automatic summation for each column. Does someone have any ideas on this? (I'm not a programmer) Link to comment Share on other sites More sharing options...
playlet Posted January 5, 2010 Share Posted January 5, 2010 (edited) --- Edited August 18, 2016 by playlet Link to comment Share on other sites More sharing options...
llewxam Posted January 5, 2010 Share Posted January 5, 2010 I need to display data from a .csv file but I don't know how to do it. This is an example of the file, each line ends with CRLF. 2010-01-05 10:46;0;0;0;1;0;0;0;0;0 2010-01-05 11:42;0;1;0;0;0;0;0;0;0 2010-01-05 12:14;0;0;0;0;1;0;0;0;0 The goal is to read the data and display it in a table with automatic summation for each column. Does someone have any ideas on this? (I'm not a programmer) How about do something like: $break=StringSplit($line,";") Of course, $line is to represent each line of the file, which you could get with FileReadLine. Anyway, StringSplit will break up a line according to the delimiter, in this case using ; makes sense. You will wind up with $break[0] telling you how many items there are, in your examples there will be 10. The first result ( $break[1] ) will be "2010-01-05 10:46" and you could break that up with StringMid or another StringSplit with a delimiter of " " if you would prefer, but I would use StringMid. I never used StringSplit to split a StringSplit result, syntax would be ugly!!! Hopefully that helps. Ian My projects: IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged. INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them. PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses. Sync Tool - Folder sync tool with lots of real time information and several checking methods. USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions. Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent. CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction. MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app. 2048 Game - My version of 2048, fun tile game. Juice Lab - Ecigarette liquid making calculator. Data Protector - Secure notes to save sensitive information. VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive. Find in File - Searches files containing a specified phrase. Link to comment Share on other sites More sharing options...
Stilgar Posted January 5, 2010 Share Posted January 5, 2010 You can use this function: http://thorsten-willert.de/Themen/AutoIt/_CSV2Array.au3 Example: #include <_CSV2Array.au3> #include <Array.au3> $aArray = _CSV2Array("c:\\file.csv") _ArrayDisplay($aArray) jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
lgnihlman Posted January 6, 2010 Author Share Posted January 6, 2010 You can use this function: http://thorsten-willert.de/Themen/AutoIt/_CSV2Array.au3 Example: #include <_CSV2Array.au3> #include <Array.au3> $aArray = _CSV2Array("c:\\file.csv") _ArrayDisplay($aArray) Thanks everyone ! The _ArrayDisplay func. will do the job for me. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now