Loading 0
Share

My Blog

Scroll Down

Download and save Google Sheet to CSV with PHP and name today's date

Download and save Google Sheet to CSV with PHP and name today's date

Hi, here is a simple solution to a customer's problem.

The client kept a product file in Google Sheets (Google's excel) and wanted to download this file to a csv file once a day and upload it to his server.

Now if it is an import it can be done easily with WP ALL IMPORT, you just share your google sheet, get the url and list it in WP ALL IMPORT during the process of creating a new Import.

However, in case you want the csv as a file and in fact with today's date for various reasons (eg to update your local Microsoft excel daily from a specific online url, etc.), you can do your job very easily with a php script.

I quote the script as it is, anyone who has a question below:

<?php
$csv = file_get_contents('https://docs.google.com/spreadsheets/d/ID_ΤΟΥ_GOOGLE_SHEET_ΣΟΥ/export?format=csv');
$fp = fopen("CSVs/".date('d-m-Y').".csv","wb");
fwrite($fp,$csv);
fclose($fp);
?>

This post is also available in: Ελληνικά

Leave a Reply

Your email address will not be published. Required fields are marked *

01.

Here you can see all the services I provide

Registration and management of domain names (website address such as www.nicolaslagios.com)

Also management of dns records (e.g. connecting the domain to a specific server, fixing email spam problems, etc.)

Also ssl renewals etc

Installation and management of web & mail server in ubuntu vps with virtualmin, plesk, cpanel

Also studying and fixing server problems.

Necessary condition, the target server meets the conditions

At the moment for new wordpress websites you can choose from ready-made themes and we change the content (no custom changes). You can buy with a fixed price by clicking here!

My team and I undertake any data bridging implementation for Wordpress, Prestashop, Opencart, Joomla platforms.

We can connect data from any source, as long as the structure is stable and there is proper documentation and briefing.

We undertake the creation, regulation and enrichment of pages for social networks: Facebook, Linkedin, Instagram (profile), Twitter (profile), Tiktok (profile).

We also undertake the first boost of your pages for quick results in followers.

We undertake the repair and maintenance of your existing wordpress website.

For more information about the services, you can read the following and return here to schedule a meeting with me: https://maxservices.gr/en/internet-services/website-services-blank/additional-website-services/