I have more than 500 cms pages in my Magento store, and i want to change all meta descriptions based on a CSV file. There are two columns in my csv file:

  1. Cms Page identifier
  2. Meta description

2 Answers 2


Copy this code and put it on your magento root directory,You need to change your file path.

error_reporting(E_ALL | E_STRICT);
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);
ini_set('memory_limit', '600M');
ini_set('max_execution_time', 1800);

$fileLocation = Mage::getBaseDir('media') . DS . 'metadata.csv';
$mage_csv = new Varien_File_Csv(); //mage CSV
$data = $mage_csv->getData($fileLocation); //path to csv
$cmsData = Mage::getModel('cms/page');

foreach ($data as $_data) {
    $pageTitle = Mage::getModel('cms/page')->load($_data[0], 'identifier');
    if ($pageTitle->getPageId()) {

echo 'done meta';
  • 1
    this works, but it will take 1.3 eternities for 500 pages.
    – Marius
    Jul 22, 2015 at 8:09
  • @kanika it's working
    – user28311
    Jul 22, 2015 at 8:27

The cms pages are flat entities. This means that each cms page is stored as a row in the table cms_page.
You can write a simple php script that parses the csv file and just runs queries like this:

UPDATE `cms_page` set `meta_description` = 'YOur meta description here' where `identifier` = 'identifier_here';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.