SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Jun 2007
    Posts
    148
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    DataTable Import CSV file

    I am able to import a CSV file with the code below. I noticed that after the import, all the values for different columns (but in the same row) from the csv file are saved together. Since I need to match some values, so I need to parse thru each cell data.

    Data_Table = "C:\Test_Securities_File.csv"
    DataTable.Import(Data_Table)
    DataTable.ImportSheet "C:\Test_Securities_File.csv",1,"Action1"
    ''RowCnt = DataTable.GetSheet("BLACKprices").GetRowCount
    RowCnt = DataTable.GetRowCount
    ''msgbox RowCnt
    For i=1 to 2 'RowCnt
    DataTable.GetSheet("Action1").SetCurrentRow(i)
    ''Msgbox DataTable.Value(1,1)
    CellVal =DataTable.Value(1,2)
    ArrayVal = split(theo,",",-1,1)
    For each element in ArrayVal
    msgbox element
    Next
    '
    Next

    After doing some research, I mostly found threads that open excel file by creating excel objects, read the values and do whatever. But I don't want/need to open the excel process by creating objects.

    My question is instead of splitting the cellVal to an array, is there a different way to do it? basically I try to avoid loop inside loop like above. Thanks guys!
    "God doesn't play dice" - Einstein

  2. #2
    Junior Member
    Join Date
    Dec 2007
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: DataTable Import CSV file

    The problem is with your csv file. If you just rename your xls file to csv and then try importing, then u face this issue. Try copying the data in a new file and then saving it as csv first time itself so that the features of xls do not get applied. Then use the same code. It should work fine.

    Hope this helps.
    Thanks,
    Anita

  3. #3
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: DataTable Import CSV file

    CSV are plain text files. Why don't you use FSO objects?

  4. #4
    Member
    Join Date
    Jun 2007
    Posts
    148
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: DataTable Import CSV file

    AnitaMittal,
    I tried your suggestion, didn't work.
    Tarun - I will try your suggestion.
    Thanks both of you.
    "God doesn't play dice" - Einstein

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:51 PM.

Copyright BetaSoft Inc.