Search code examples
csvimacros

How to pass file name to ADD EXTRACT in imacros


Suppose this is my file name startLine.iim

SET !DATASOURCE C:\Users\user\Documents\iMacros\Downloads\status.csv
SET !DATASOURCE_LINE 1
SET abc {{!COL1}}

And this is my another file endLine.iim

FILEDELETE NAME=status.csv
ADD !EXTRACT startLine.iim

SAVEAS TYPE=EXTRACT FOLDER=C:\Users\user\Documents\iMacros\Downloads FILE=status.csv

What I'm doing is I'm extracting data from a .csv file from startLine.iim file and processing it and deleting the file status.csv and again taking the updated value by using ADD !EXTRACT startLine.iim and saving it back to status.csv. I wanted to know how to pass a file name to ADD !EXTRACT? Any help would be much appreciated. Thanks in advance.


Solution

  • You can use a variable:

    SET !VAR0 profileData.csv
    ADD !EXTRACT {{!VAR0}}
    

    Or quotemarks to specify a filename as a string:

    ADD !EXTRACT "profileData.csv"