A powerful Google Apps Script that transforms Shopify sales data exports into beautifully formatted pivot tables with advanced heatmap visualization and comprehensive analytics. Perfect for Shopify store owners and managers who need quick insights from their sales data.
Shopify's native reporting can be overwhelming and doesn't always present data in the most actionable format. This script takes your raw Shopify sales exports and creates:
- Clear visual patterns in your sales data with color-coded heatmaps
- Location-based comparisons across multiple store locations
- Product performance analysis sorted by sales volume
- Time-series visualization showing daily sales trends
- Professional formatting ready for presentations and reports
- Automatic Shopify Data Processing: Works seamlessly with Shopify POS and online sales exports
- Multi-Location Support: Perfect for businesses with multiple Shopify POS locations
- Product Variant Analysis: Handles both product titles and variant-specific data
- Currency-Aware Calculations: Properly formats sales totals and gross sales
- Interactive Heatmap: Color-coded cells showing sales patterns at a glance
- Negative Value Detection: Highlights returns and refunds in soft red-orange
- Location Performance: Compare sales across all your store locations
- Product Ranking: Automatic sorting by sales performance
- Daily Trend Analysis: Visualize sales patterns over time
- Executive-Ready Reports: Clean formatting suitable for stakeholder presentations
- Automated Processing: Updates automatically when you paste new Shopify data
- Visual Data Borders: Professional table formatting
- Summary Statistics: Key metrics clearly displayed
- Multi-location insights from Shopify POS data
- Product performance comparisons across variants
- Visual sales trend analysis for inventory planning
- Quick executive summaries from raw Shopify exports
- Return and refund analysis (negative values highlighted)
Use this sample ShopifyQL query to export the perfect dataset:
FROM sales
SHOW net_items_sold, gross_sales, total_sales
WHERE product_title IN ('PRODUCT NAMES HERE', 'COMMA SEPERATED')
GROUP BY pos_location_name, day, product_title_at_time_of_sale,
product_variant_title_at_time_of_sale WITH GROUP_TOTALS, TOTALS, CURRENCY 'USD'
SINCE 2024-09-13 UNTIL 2024-10-30
ORDER BY total_sales__pos_location_name_totals DESC, day ASC,
total_sales__pos_location_name_day_product_title_at_time_of_sale_totals DESC,
total_sales DESC, pos_location_name ASC, product_title_at_time_of_sale ASC,
product_variant_title_at_time_of_sale ASC
VISUALIZE total_salesNote
Replace 'PRODUCT NAMES HERE', 'COMMA SEPERATED' with your actual product names, or remove the WHERE clause entirely to analyze all products.
- Create a new Google Sheets document
- Go to Extensions β Apps Script
- Replace the default code with the Sales Data Processor script. The code can be found here
- Save the project as "Shopify Sales Processor"
- Return to your spreadsheet
- Create a sheet named "RawData" (exact name required)
- Paste your Shopify export data directly into this sheet
- The script will automatically process your data when you make any edit
- View your formatted results in the new "FormattedData" sheet
Your Shopify export must include these columns (standard Shopify export format):
| Required Shopify Columns | Optional Shopify Columns |
|---|---|
POS location name |
Total sales |
Day |
Gross Sales |
Net items sold |
Product title at time of sale |
Product variant title at time of sale |
POS location name,Day,Product variant title at time of sale,Net items sold,Total sales,Gross Sales
Main Street Store,2024-01-15,Organic Coffee Beans - Dark Roast,12,36.00,40.00
Main Street Store,2024-01-15,Premium Tea Bags - Earl Grey,5,12.50,15.00
Downtown Location,2024-01-16,Organic Coffee Beans - Medium Roast,18,54.00,60.00- Paste your Shopify export into the "RawData" sheet
- Make any small edit (like adding a space) to trigger processing
- Check the "FormattedData" sheet for your beautiful results
- Refresh your data anytime by pasting new exports and editing the sheet
If you prefer manual control:
- Open Extensions β Apps Script
- Select
processCSVDatafrom the function dropdown - Click Run to process your data
- View results in the FormattedData sheet
Transform your raw Shopify data into a clean matrix showing:
- Rows: Your store locations and products
- Columns: Each day from your export
- Values: Color-coded sales quantities with heatmap
- Visual cues: Immediate pattern recognition
Key metrics at a glance:
- Total units sold across all locations
- Total revenue (if sales data included)
- Gross sales totals (if gross sales data included)
- Performance period covered
Automatically sorted list showing:
- Best performing products by sales volume
- Individual product totals for quantities and revenue
- Easy identification of your top sellers
- Underperforming items that need attention
- Positive sales: White to deep blue gradient (higher = darker blue)
- Returns/Refunds: White to soft red-orange gradient (more returns = darker orange)
- Zero activity: Clean white background
- Professional borders: Clean table presentation
- Compare performance between your physical stores
- Identify location-specific trends for inventory planning
- Spot seasonal patterns across different markets
- Optimize stock distribution based on location performance
- Understand variant preferences (size, color, style)
- Identify bestselling combinations for marketing focus
- Spot underperforming variants for discontinuation
- Plan inventory based on variant-specific demand
- Visualize negative values (returns/refunds) in red-orange
- Identify problematic products with high return rates
- Track refund patterns by location or time period
- Improve product quality based on return data
Modify the SINCE and UNTIL dates in your query:
SINCE 2024-09-01 UNTIL 2024-12-31 -- Analyze Q4 performanceUse the WHERE clause to analyze particular product lines:
WHERE product_title IN ('Winter Collection', 'Holiday Specials', 'New Arrivals')In the script, modify color contrast for better visibility:
var enhancedRatio = Math.pow(ratio, 0.5); // Current setting
// Use 0.3 for subtle colors, 0.8 for dramatic contrast- Check your ShopifyQL query includes all required fields
- Verify column names match exactly (Shopify's standard format)
- Ensure data export completed successfully from Shopify
- Verify your date range in the ShopifyQL query captured sales
- Check if product filter is too restrictive
- Confirm POS location names are not empty in your export
- Ensure Net items sold column contains numeric values (not text)
- Check for currency symbols in sales columns (should be numbers only)
- Verify data isn't filtered in Shopify before export
- Limit date ranges to 1-3 months for faster processing
- Use product filters in ShopifyQL to focus on specific categories
- Process location by location if you have many stores
- Run weekly reports to track trends and spot issues early
- Compare month-over-month by processing different date ranges
- Share formatted results directly with team members (no raw data confusion)
- Use for inventory planning by identifying fast-moving products
- Track seasonal patterns by comparing same periods across different years
Focus on high-value products:
WHERE total_sales > 1000Analyze specific time periods:
SINCE -30d -- Last 30 days
SINCE -1y UNTIL -1y+3m -- Same quarter last yearInclude specific locations:
WHERE pos_location_name IN ('Main Store', 'Mall Location')Transform this raw Shopify export:
Main Store,2024-01-15,Coffee Beans,12,$36.00,$40.00
Main Store,2024-01-16,Coffee Beans,8,$24.00,$28.00
Mall Store,2024-01-15,Coffee Beans,22,$66.00,$72.00
Into this beautiful analysis:
Location Product 1/15 1/16 1/17
Main Store Coffee Beans 12 8 15
Tea Selection 5 12 7
Mall Store Coffee Beans 22 18 25
Pastries -2 15 11
With color-coded visualization and complete analytics below!
This tool is ideal for:
- Store Managers: Daily sales tracking and location comparison
- Inventory Managers: Product performance and restocking decisions
- Marketing Teams: Identifying bestsellers for promotional focus
- Executives: High-level sales summaries and trend analysis
- Multi-location Owners: Comparative performance across stores
- Shopify store with POS or online sales data
- Google Sheets access (free Google account)
- Basic familiarity with Shopify's export functionality
- ShopifyQL access for advanced data queries
Ready to transform your Shopify sales data into actionable insights?
- Copy the script into Google Apps Script
- Export your Shopify data using the provided ShopifyQL query
- Paste into the RawData sheet and watch the magic happen
- Share beautiful reports with your team in minutes
Stop struggling with raw CSV exports and start making data-driven decisions! ππ
Built with π specifically for Shopify merchants who want better insights from their sales data.