Jump to content
UBot Underground

Reading Big Csv File To Iterate


Recommended Posts

Hello, I'm just creating a blog post about reading some "big" csv file. Lets say, 100.000 lines, 2 columns, name and age.
 
I wish to load the data and iterate/sum the age variable, just for documenting it.
 
set(#total,0,"Global")
set(#row,0,"Global")
create table from file("C:\\Users\\Usuario\\Desktop\\names.csv",&dataTable)
loop($table total rows(&dataTable)) {
    set(#total,$add(#total,$table cell(&dataTable,#row,1)),"Global")
    increment(#row)
}

 
This is my UBot code. My issue is, with 100k lines this goes a bit slow, maybe its not good idea to load it on a table.
 
this is my mockup post:
 
any guidance? my post is not a competition for speed, just a guide to read/iterate a csv file in a good way. I wish to have the data loaded and do not use a driver or a database query to do a SUM. Just a simple loop.
 
thanks in advance.
 
PD: names file attached.

 

names.csv

Edited by flamerz
Link to post
Share on other sites

not sure why the plugin its not working on my ubot

 

 

works:  create table from file("H:\\FileCenter\\test.csv",&test)
does nothing:  plugin command("Bigtable.dll", "Large Table From file", "H:\\FileCenter\\test.csv", &test2)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...