Edit data in CSV

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Edit data in CSV

by passwd on Sat May 07, 2016 3:14 am

Hello! I am trying to read data from csv, then use it in webform, but after this I need to edit this data in the CSV to be sure which lines has been used.
How can I read only certain lines from CSV file which begin only with certain symbol? And how can I edit first symbol of CSV line to tell program not to use this line again next time?

Something like that:
Code: Select all
@Line1
Line2
Line3

Reading line1 => used, goto line2;
Reading line2 => not used, use line2;
Line2 used => change line2 to @line2;

Maybe I can write this "@ parameter" in col1, and if col1 = "@" then goto next line? How can I write this in IMacros?
passwd
 
Posts: 6
Joined: Sat May 07, 2016 2:53 am

Re: Edit data in CSV

by chivracq on Sat May 07, 2016 2:25 pm

passwd wrote:Hello! I am trying to read data from csv, then use it in webform, but after this I need to edit this data in the CSV to be sure which lines has been used.
How can I read only certain lines from CSV file which begin only with certain symbol? And how can I edit first symbol of CSV line to tell program not to use this line again next time?

Something like that:
Code: Select all
@Line1
Line2
Line3

Reading line1 => used, goto line2;
Reading line2 => not used, use line2;
Line2 used => change line2 to @line2;

Maybe I can write this "@ parameter" in col1, and if col1 = "@" then goto next line? How can I write this in IMacros?

Woaw...!, very interesting Question, and yep, it's all possible, but CIM, read my Sig for me to answer it...

I need and use the same Functionality (there are several Solutions even..., I can think of 3 already...) for some funny AI (Art :oops: ) Project of mine in a few of my Auto-morphing Scripts/DataSources using a simple Trick that I have already mentioned once or twice on the Forum... :twisted: (One of those 3 Solutions can easily be found if you search the Forum on "morphing"..., but it's not the one concerning the "simple Trick"...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6481
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Edit data in CSV

by passwd on Sat Jun 04, 2016 4:02 am

I have already done this by PHP =)
passwd
 
Posts: 6
Joined: Sat May 07, 2016 2:53 am

Re: Edit data in CSV

by chivracq on Sat Jun 04, 2016 10:33 pm

passwd wrote:I have already done this by PHP =)

OK, good to hear 1 month later, but Thanks anyway for the Feedback, even if I had to ask for it, consider sharing your Solution with more Details to make the Thread useful for other Users...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6481
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Edit data in CSV

by passwd on Sun Jun 05, 2016 5:25 am

Instead of getting all the data from CSV, I decided to get it all from forms I have made on html and php. You can use MySQL or TXT file. Then just load all your data to this file or MySQL database and select it with PHP showing in form. Everything you need next is just to open the PHP form and get all the data you need. You can add few buttons with some actions. And iMacros should just get the data from localhost(or server based) PHP form, do all the work and go back to the form to press buttons when something went done to modify lines.
passwd
 
Posts: 6
Joined: Sat May 07, 2016 2:53 am

Re: Edit data in CSV

by passwd on Sun Jun 05, 2016 5:29 am

The second way is to make Autoit script which will monitor some folder. If a file with certain name appeared then Autoit script must do an action. But in iMacros you need just to add lines which will create this CSV files when it's needed to make an action. And based on its name Autoit should do the different actions.
passwd
 
Posts: 6
Joined: Sat May 07, 2016 2:53 am

Re: Edit data in CSV

by chivracq on Sun Jun 05, 2016 8:03 am

passwd wrote:Instead of getting all the data from CSV, I decided to get it all from forms I have made on html and php. You can use MySQL or TXT file. Then just load all your data to this file or MySQL database and select it with PHP showing in form. Everything you need next is just to open the PHP form and get all the data you need. You can add few buttons with some actions. And iMacros should just get the data from localhost(or server based) PHP form, do all the work and go back to the form to press buttons when something went done to modify lines.

passwd wrote:The second way is to make Autoit script which will monitor some folder. If a file with certain name appeared then Autoit script must do an action. But in iMacros you need just to add lines which will create this CSV files when it's needed to make an action. And based on its name Autoit should do the different actions.

Hum, very good-good + very-good...!

A similar Solution to Sol_1 and maybe a bit more simple than using Googleforms would be to use a Googledoc as the DataSource that you can edit on the fly directly from your iMacros Script.

And a Solution in pure '.iim' iMacros Script I had in mind which is as well a bit similar to Sol_1 or even closer to the Sol_3 I just mentioned is to have the DataSource saved as a '.TXT' or '.HTML' File (and not '.CSV'), '.TXT' is the simplest..., and to open that File from the Browser (and therefore from iMacros) in a second TAB to use as the DataSource with 'EXTRACT' where it's possible to extract a single Cell or the complete Table with one Extract, manipulate the whole Data with 'EVAL()', close the TAB, delete the File with 'FILEDELETE' and recreate it with the new Data with 'SAVEAS' (+ 'TYPE=EXTRACT').
A little Trick to help locating easily a specific Cell is to add an extra Col with some unique Identifier like 'Row_1' / 'Row_2' / etc that will serve as Anchor + Relative Positioning to locate and extract the specific Cell.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6481
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Edit data in CSV

by janib4all on Tue Jun 07, 2016 1:56 pm

Use Java Scripting instead of simple IIM file. You can store all posted/fetched data in an Array and through a loop, you can check whether a certain record is utilized or not!
Hire the BoT-fReeak!
botspecialist.blogspot.com
janib4all
 
Posts: 132
Joined: Tue Jul 20, 2010 11:44 pm
Location: Karachi, Sindh, Pakistan

Re: Edit data in CSV

by chivracq on Tue Jun 07, 2016 8:32 pm

janib4all wrote:Use Java Scripting instead of simple IIM file. You can store all posted/fetched data in an Array and through a loop, you can check whether a certain record is utilized or not!

Same thing can still be done using some Temp SAVE/DataSource File like I do..., I do everything to avoid using a '.js' Script, I've always managed until now, and I'm nearly sure I do more complex "things" in pure '.iim' than anybody else posting on the Forum I would think..., search my Posts on "IA/AI auto-morphing", @janib4all, I've already posted and explained a few times how far I go with iMacros in pure '.iim', no need for JavaScript... (Well is still the normal/official way to achieve Conditional Behaviour, yep...!)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6481
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests

-->