Sign in to follow this  
Followers 0
lgnihlman

how to display data from .csv file?

5 posts in this topic

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)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0