PrestaShop → Google Sheets: product export with Webservice and Apps Script
const url = shopUrl +
'/api/products';
const res = UrlFetchApp.fetch(url, {
headers: {
Authorization: 'Basic ' + token
}
});
A Google Sheet can be much more than a manual export.
With PrestaShop Webservice and Apps Script you can build a repeatable catalogue report without downloading a CSV every time.
The workflow
PRESTASHOP
↓
WEBSERVICE API
↓
APPS SCRIPT
↓
NORMALIZE
↓
GOOGLE SHEETS1. Start read-only
A reporting workflow does not need write permissions.
Tip
Give the API key only the permissions the integration actually needs.
2. Request specific fields
/api/products?display=[id,reference,price,active]&output_format=JSON3. Apps Script configuration
const CONFIG = {
baseUrl: 'https://shop.example',
apiKey: 'YOUR_WEBSERVICE_KEY',
batchSize: 100
};4. HTTP request
function fetchProducts() {
const url =
CONFIG.baseUrl +
'/api/products' +
'?display=[id,reference,price,active]' +
'&output_format=JSON' +
'&limit=0,' + CONFIG.batchSize;
const auth = Utilities.base64Encode(CONFIG.apiKey + ':');
const response = UrlFetchApp.fetch(url, {
method: 'get',
headers: { Authorization: 'Basic ' + auth },
muteHttpExceptions: true
});
if (response.getResponseCode() !== 200) {
throw new Error('PrestaShop HTTP ' + response.getResponseCode());
}
return JSON.parse(response.getContentText());
}5. Normalize first
function productsToRows(products) {
return products.map(product => [
product.id,
product.reference,
product.price,
product.active
]);
}6. Write in one operation
Build a two-dimensional array and write it with one setValues() call instead of cell-by-cell updates.
7. Identifier strategy
For internal reporting, id_product is convenient. For ERP or supplier integrations, reference / SKU is usually the external business identifier.
8. Products are not stock
A stock report also needs /api/stock_availables, joined through id_product and id_product_attribute.
9. Decide the row model
Before coding, decide whether you want one row per product or one row per combination.
10. Sync metadata
Keep Last sync, HTTP status, Rows imported and Duration. A Sheet is excellent for reporting, review, mappings, manual overrides and lightweight automations; it does not need to become your primary database.
What to do next
Evolve the read-only report into a supplier-feed transformation pipeline, keeping raw input separate from mapped output. For larger catalogues, apply Webservice pagination before scheduling repeated syncs.