CanaDutch 0 Posted March 3, 2011 Report Share Posted March 3, 2011 I'm having some problems with saving new data to a pre-existing .csv file without overwriting data that's already in the file. I'm creating a bot that can sign up and submit to various web 2.0 sites. If I want to let ubot sign up to onsugar and weebly and the next day to blogspot I want ubot to save all the usernames and passwords to the same. csv file. The userdata.csv file will have details like the email address and the login details for each web 2.0 site as follows: botbot@gmail.com,emailpass,adress,city,postalcodeonsugar,username,passweebly,username,passblogspot,username,pass When my bot signs up to a web 2.0 site it needs to be able to retrieve the email address by loading a table cell from userdata.csv at row #0 and column #0. Then the bot will pick a random username and password to fill in the fields during sign up. Since I want to save the username and password to the userdata.csv file, I've tried using 'set table cell' to add the username and password to a new table. Then I tried to save the data of the new table to userdata.csv. But that makes ubot overwrite the userdata.csv with only the new username and password. Then I tried to let ubot load the data in userdata.csv file and save the new table in userdata.csv, but that just overwrites userdata.csv not saving anything at all, leaving me with an empty csv. file... I created a small script to demonstrate what I'm trying to do. To sum it all up, during a sign up I want to be able load data from a specific.csv file (like an email address) and then save a new piece of data (like a username) to a specific cell in that same .csv file. I wish ubot had the option to 'save to file' in a way that does not overwrite the old file but instead overwrites the cells specified. I hope someone can help me do this even without such an option. Thanks in advancefail2.ubot Quote Link to post Share on other sites
UBotBuddy 331 Posted March 3, 2011 Report Share Posted March 3, 2011 What is the purpose of the file you are loading into your Table? The reason I ask is that you are over-writing that data in the Table almost as soon as you load the Table. SO that is why it appears to be changing data when you save it. Quote Link to post Share on other sites
JohnB 255 Posted March 3, 2011 Report Share Posted March 3, 2011 Hi Patrick. One way you can accomplish this is to load the csv file into a table and create a sub that loops through the columns and places the contents into a list (or lists if you have more than one column/row). That way as you add to the list it does not overwrite the existing content. When you are done with the lists, you can then add them to a table as a column (or row) and save the table as a new csv file. John Quote Link to post Share on other sites
CanaDutch 0 Posted March 3, 2011 Author Report Share Posted March 3, 2011 Hi JohnB. I'm still pretty new to UBot so I'm having a hard time figuring out how to do what you're suggesting. Any chance you could perhaps edit the .ubot file I added so I can see what you mean? Also I'm planning to have 50+ rows in the .csv file. Thanks Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.