babarali124 wrote:Hi,
Firefox version 54
Imacros VERSION BUILD=9030808 RECORDER=FX
Windows 10 64 bit
I just wanted to know if there is a way of extracting data from the columns of 2nd csv file using the first csv file. I have done this with the text file where I give the path of the 2nd file and extract the entire data from it. But I am confused about extracting data from a particular column inside a csv file. Let me give you an example and my code below
2. CSV files
First CSV file contains column 4 = path to the second csv file
2nd CSV file contains 4 columns , I need data from column number 3 from the 2nd csv file to be extracted and used.
Below is the code for extracting data from a text file.
Code: Select all
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
SET !TIMEOUT_PAGE 15
SET !TIMEOUT_STEP 0
SET !DATASOURCE testing.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!loop}}
TAB OPEN
TAB T=2
URL GOTO={{!COL15}}
TAG POS=1 TYPE=PRE ATTR=* EXTRACT=TXT
TAB T=1
TAB CLOSEALLOTHERS
TAG POS=1 TYPE=TEXTAREA ATTR=CLASS:keyword-textarea*form-control* CONTENT={{!EXTRACT}}
The Col15 in the above example has the value of :
Code: Select all
file:///C:\Users\Ali\Documents\iMacros\Datasources\keywords.txt
But I want to use a csv file and get a data from particular column.
Hum..., Thread has nothing specific to iMacros for FF, the 'General' Sub-Forum would have been more appropriate... (But no need to duplicate now...)
Hum, and the Terminology you use is a bit confusing, try to keep the Term(s) "extract"/"extracting"/"extraction" when "extracting" Data from a Web-Page/Site, you don't really "extract" from a DataSource..., you can rather use "use"/"get"/"pull"/"fetch"/"retrieve"/"query"...
Even if hum..., I see, you use the Trick to open a '.TXT' File in a 2nd Tab and to "re-extract" its full Content with 'EXTRACT', so in a way, you are indeed "extracting" or "re-extracting" its Content..., but you should mention that then..., it's a bit "confusing" otherwise... (And until you needed that Functionality, I guess I was the only one using it...)
But, hum..., that Trick is a Trick or "Special" Technique I use in order to be able to retrieve very quickly the whole Content of a DataSource (as a '.TXT' File, it doesn't work properly and reliably with '.CSV' Files as it depends on a few Settings at the OS and Browser Levels...), if you want to check if that File already contains some specific Content, to avoid Duplicates for example, or if you want to know how many Rows you have in your DataSource or if you want to locate quickly a Specific Row, instead of having to loop through that (2nd) DataSource Row by Row with the "Standard" Loop Mechanism, from an '.iim' or '.js' Script...
Then like I said, it's a Trick, if you don't need that Functionality, don't use it, and treat it like a "Standard" DataSource if you only need one specific Column/Cell... => Use the '!DATASOURCE' Command again for the 2nd DataSource, you already have its Path in your 1st DataSource...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...