How to backup Twitter Friends using PowerShell and Excel
By Fredrik WallTwitter have been cleaning out spamers and some ordinary users got cleaned too.
It can be hard to know wish Twitter Friends you had yesterday and whish you got today.
From now on I will use a PowerShell script that I wrote today.
I did some changes to James O’Neils Twitter Function Get-TwitterFriend to
get It to work with more then 100 Friends.
And then Export it to a csv file and imported it in to Excel.
This can be handled with a export or import to Excel function.
[System.Reflection.Assembly]::LoadWithPartialName(”System.Web") | Out-Null
$userName = "username" $password = "password" $txtFile = "c:\textfile.txt" Function Get-TwitterFriends { param ($username, $password, $ID) if ($WebClient -eq $null) {$Global:WebClient=new-object System.Net.WebClient } $WebClient.Credentials = (New-Object System.Net.NetworkCredential -argumentList $username, $password) $page = 1 $Friends = @() if ($ID) {$URL="http://twitter.com/statuses/friends/$ID.xml?page="} else {$URL="http://twitter.com/statuses/friends.xml?page="} do { $Friends += (([xml]($WebClient.DownloadString($url+$Page))).users.user ) $Page ++ } while ($Friends.count -eq 100) $Friends } Get-TwitterFriends $userName $password | select name,screen_Name,url | export-csv $txtfile
Then start Excel
and Open, file types .txt and chose your file.
In the text import Wizard step 1
Change Start import at row 1 to 2.
Then we do not get the row with PowerShell’s information.
In the text import Wizard step 2
Change Delimiters from Tab to Comma
When Excel opens you got all of your Friends in an excel document.
To view whole names in columns just push down right arrow over
the first row and to the left of the first column.
No you have the worksheet marked and then just double click on the
line between column A and B.
The first Friends on the list is the last Friends you have added to
Twitter.
I hope this will help you!
My next post will be a PowerShell and .net Windows Forms App
for this.
Related posts:

Comments
RT: How to Backup Twitter Friends using #PowerShell and Excel, http://bit.ly/mPu4F http://bit.ly/4svgk
How to backup Twitter Friends using PowerShell and Excel | Fredrik … http://bit.ly/MRSON
[...] Twitter Friends with PowerShell and Excel Automatically This script is an updated version of the How to Backup Twitter Friends with PowerShell and Excel post earlier today. In this version I use the out-Excel function by The Pathological [...]