AshishHansdah
Here small code snippet that would help you get started
function fetchShopifyProducts() {
var shopifyStoreUrl = 'your-shopify-store.myshopify.com'; // Replace with your Shopify store URL
var accessToken = 'your-access-token'; // Replace with your access token
var endpoint = 'admin/api/2023-01/products.json'; // You can change the API version to the latest supported by Shopify
var url = `https://${shopifyStoreUrl}/${endpoint}`;
var options = {
"method": "get",
"contentType": "application/json",
"headers": {
"X-Shopify-Access-Token": accessToken
}
};
try {
var response = UrlFetchApp.fetch(url, options);
var jsonResponse = JSON.parse(response.getContentText());
Logger.log(jsonResponse);
// Optionally, parse the jsonResponse to write the data to your Google Sheet
} catch (error) {
Logger.log("Error fetching products: " + error.toString());
}
}