i have thousand of email in my gmail account.In the email i have a many files in each email but i need to download a file with csv extension and copy it to folder in my PC. Any idea how would i do this in PHP ??
You may find this useful, for the basics of connecting to gmail from PHP/IMAP.
And here is more detailed info about getting attachments via IMAP.
You can easily filter the attachments by filename to get only .CSV files, using preg_match() or even strpos().