Créer un fichier Excel qui actualise les taux de 4 devises
Bonjour à tous !
Je voudrais un fichier Excel qui actualise le taux de 4 devises.
J'ai besoin du taux moyen du mois dernier par rapport à la date d'aujourd'hui.
Ci-dessous l'image qui explique cela.
Le taux average.
Pourriez-vous me dire s'il est possible de le faire sur Excel s'il vous plaît ?
Je vous remercie de toute l'attention que vous porterez à ma demande.
Cordialement,
Alexandre BELFORT
<?php
//This is a PHP(4/5) script example on how eurofxref-daily.xml can be parsed
//Read eurofxref-daily.xml file in memory
//For this command you will need the config
//option allow_url_fopen=On (default)
$XMLContent=file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
//the file is updated at around 16:00 CET
foreach($XMLContent as $line){
if(preg_match("/currency='([[:alpha:]]+)'/",$line,$currencyCode)){
if(preg_match("/rate='([[:graph:]]+)'/",$line,$rate)){
//Output the value of 1EUR for a currency code
echo'1€='.$rate[1].' '.$currencyCode[1].'<br/>';
//--------------------------------------------------
//Here you can add your code for inserting
//$rate[1] and $currencyCode[1] into your database
//--------------------------------------------------
}
}
}
?>
<?php
function StartElement($parser, $name, $attrs) {
if (!empty($attrs['RATE'])) {
echo "1€=".$attrs['RATE']." ".$attrs['CURRENCY']."<br />";
}
}
$xml_parser= xml_parser_create();
xml_set_element_handler($xml_parser, "StartElement", "");
// for the following command you will need file_get_contents (PHP >= 4.3.0)
// and the config option allow_url_fopen=On (default)
xml_parse($xml_parser, file_get_contents ("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"));
xml_parser_free($xml_parser);
?>
Exemple :
<?php
//This is aPHP(5)script example on how eurofxref-daily.xml can be parsed
//Read eurofxref-daily.xml file in memory
//For the next command you will need the config
//option allow_url_fopen=On (default)
$XML=simplexml_load_file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
//the file is updated at around 16:00 CET
foreach($XML->Cube->Cube->Cube as $rate){
//Output the value of 1EUR for a currency code
echo '1€='.$rate["rate"].' '.$rate["currency"].'<br/>';
//--------------------------------------------------
//Here you can add your code for inserting
//$rate["rate"] and $rate["currency"] into your database
//--------------------------------------------------
}
?>