<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: karim alfhar</title>
    <description>The latest articles on DEV Community by karim alfhar (@alfhar).</description>
    <link>https://dev.to/alfhar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4169404%2F7cbcc720-a545-40cb-86d3-7e06e5231ec6.png</url>
      <title>DEV Community: karim alfhar</title>
      <link>https://dev.to/alfhar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alfhar"/>
    <language>en</language>
    <item>
      <title>How I cost a restaurant menu in a plain Excel sheet (formula walkthrough)</title>
      <dc:creator>karim alfhar</dc:creator>
      <pubDate>Fri, 09 Oct 2026 17:11:30 +0000</pubDate>
      <link>https://dev.to/alfhar/how-i-cost-a-restaurant-menu-in-a-plain-excel-sheet-formula-walkthrough-4m0b</link>
      <guid>https://dev.to/alfhar/how-i-cost-a-restaurant-menu-in-a-plain-excel-sheet-formula-walkthrough-4m0b</guid>
      <description>&lt;p&gt;I build small food-cost spreadsheets for restaurant menus. They are plain Excel: no macros, no add-ins, just formulas you can read and check. This post walks through the method so you can build the same thing yourself. At the end I mention where a ready-made version fits, if you would rather not start from a blank file.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three numbers that matter
&lt;/h2&gt;

&lt;p&gt;Every menu pricing decision comes down to three numbers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Dish cost&lt;/strong&gt;: what the ingredients in one plate cost you.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Food-cost %&lt;/strong&gt;: dish cost divided by the menu price.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target price&lt;/strong&gt;: the price you need to charge so food cost lands on your target percentage.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Most owners know the first one roughly and guess the other two. A sheet makes all three explicit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Ingredient master list with unit prices
&lt;/h2&gt;

&lt;p&gt;Keep one row per ingredient with these columns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ingredient name&lt;/li&gt;
&lt;li&gt;Purchase unit (kg, L, piece)&lt;/li&gt;
&lt;li&gt;Price paid (what you actually paid for the pack)&lt;/li&gt;
&lt;li&gt;Pack quantity in the recipe unit (for example, 1000 g)&lt;/li&gt;
&lt;li&gt;Unit price = price paid divided by pack quantity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If price paid is in column C and pack quantity is in column E, the unit price formula is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;=C2/E2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example: a 1,000 g pack of boneless chicken thigh costs 180 EGP. The unit price is 180 / 1000 = 0.18 EGP per gram.&lt;/p&gt;

&lt;p&gt;Keep every price in the recipe unit (grams, millilitres, pieces). Mixing kilograms in the price column with grams in the recipe is the most common source of wrong costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Recipe lines with waste
&lt;/h2&gt;

&lt;p&gt;Each dish is a list of lines: ingredient, quantity on the plate, and waste %. Waste is the share of what you buy that you lose to trimming, peeling or cutting. It is not the same as the quantity on the plate.&lt;/p&gt;

&lt;p&gt;The line cost formula is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;line cost = quantity x unit price / (1 - waste %)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The division matters. If you buy 1,000 g of chicken and lose 20% to trimming, you have only 800 g of usable meat. So 180 g on the plate does not cost 180 x 0.18 = 32.40 EGP. It costs 32.40 / 0.80 = 40.50 EGP.&lt;/p&gt;

&lt;p&gt;Worked example for one dish (all numbers are illustrative):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Ingredient&lt;/th&gt;
&lt;th&gt;Plate qty&lt;/th&gt;
&lt;th&gt;Unit price (EGP)&lt;/th&gt;
&lt;th&gt;Waste&lt;/th&gt;
&lt;th&gt;Line cost (EGP)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Chicken thigh&lt;/td&gt;
&lt;td&gt;180 g&lt;/td&gt;
&lt;td&gt;0.18&lt;/td&gt;
&lt;td&gt;20%&lt;/td&gt;
&lt;td&gt;40.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rice&lt;/td&gt;
&lt;td&gt;150 g&lt;/td&gt;
&lt;td&gt;0.03&lt;/td&gt;
&lt;td&gt;0%&lt;/td&gt;
&lt;td&gt;4.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Garlic sauce&lt;/td&gt;
&lt;td&gt;60 ml&lt;/td&gt;
&lt;td&gt;0.10&lt;/td&gt;
&lt;td&gt;0%&lt;/td&gt;
&lt;td&gt;6.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Dish cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;51.00&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Dish cost is the sum of its line costs. In the sheet, that is a SUMIF over the recipe table, matched on dish name, so adding a new line updates the dish automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Food-cost % and margin
&lt;/h2&gt;

&lt;p&gt;Food-cost % tells you what share of the price goes to ingredients:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;food-cost % = dish cost / menu price
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this plate sells for 150 EGP, food cost is 51 / 150 = 34%. The gross margin in money is 150 - 51 = 99 EGP per plate, which is 66% of the price.&lt;/p&gt;

&lt;p&gt;Whether 34% is acceptable depends on your target. Set the target from your own rent, labour and other costs, not from a number you read in a blog post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: The target price formula
&lt;/h2&gt;

&lt;p&gt;Turn the target around to get the price you should charge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;suggested price = dish cost / target food-cost %
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a 30% target: 51 / 0.30 = 170 EGP. Then round to a price that is easy to print on a menu. In my sheet I use CEILING to the nearest 5 EGP, so 170 stays 170 and 171 becomes 175.&lt;/p&gt;

&lt;p&gt;Now compare with what you charge today:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current price 150 EGP gives 34% food cost, above a 30% target. Either raise the price toward 170, or reduce the sauce portion.&lt;/li&gt;
&lt;li&gt;Current price 180 EGP gives 28% food cost, under the target.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The formula gives you a starting point. The final decision also depends on what customers will pay nearby.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Check the whole menu
&lt;/h2&gt;

&lt;p&gt;Once every dish has a recipe, the useful view is across the whole menu. Which dishes carry the margin? Which are priced below target? Which sell often but earn little? To get a weighted margin, multiply each dish's margin per plate by its monthly sales count, add the results up, and divide by total plates sold.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistakes I see most often
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stale prices.&lt;/strong&gt; A cost sheet is only as current as its last price update. Review the master list whenever a supplier changes a price.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Waste counted twice.&lt;/strong&gt; Use waste % for trimming and prep losses. Do not add cooking loss on top unless you have measured it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mixed units.&lt;/strong&gt; Keep recipe units consistent with purchase units. Conversion errors hide in totals and are hard to spot later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treating example numbers as benchmarks.&lt;/strong&gt; The numbers in this article are examples to show the arithmetic, not targets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The ready-made version
&lt;/h2&gt;

&lt;p&gt;If you do not want to build this from scratch, I sell the English edition as a single Excel file. It has an ingredient master list with yield and waste, a recipe-cost sheet, a menu-pricing tab with target food-cost %, room for 60 recipes and 600 ingredient lines, and formulas only, with no macros.&lt;/p&gt;

&lt;p&gt;Get it here: &lt;a href="https://karimverse6102.gumroad.com/l/toksvv" rel="noopener noreferrer"&gt;https://karimverse6102.gumroad.com/l/toksvv&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also publish MENA price-data scrapers on Apify, covering things like grocery prices and currency rates. If you want to pull supplier or market prices into a sheet like this automatically, you can see the actors at &lt;a href="https://apify.com/alfhar" rel="noopener noreferrer"&gt;https://apify.com/alfhar&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>excel</category>
      <category>productivity</category>
      <category>food</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Price Your Restaurant Menu by Recipe Cost: A Practical Excel Method</title>
      <dc:creator>karim alfhar</dc:creator>
      <pubDate>Fri, 09 Oct 2026 08:40:26 +0000</pubDate>
      <link>https://dev.to/alfhar/price-your-restaurant-menu-by-recipe-cost-a-practical-excel-method-4df5</link>
      <guid>https://dev.to/alfhar/price-your-restaurant-menu-by-recipe-cost-a-practical-excel-method-4df5</guid>
      <description>&lt;p&gt;Most small restaurants and cafes set menu prices by feel: what the competitor charges, or what the owner thinks customers will pay. The problem is that a dish can sell well and still lose money. The fix is simple arithmetic, but doing it by hand for every dish, every time a supplier changes a price, is where most owners give up.&lt;/p&gt;

&lt;p&gt;This article walks through the method. At the end, I link to a spreadsheet that does the calculations for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Build an ingredient list with real purchase prices
&lt;/h2&gt;

&lt;p&gt;Start with every raw ingredient you buy. For each one, record the unit you buy in (a kilo, a litre, a carton of 30 eggs), the price you paid for that unit, and the waste you lose in prep: trimmings, peel, spoilage. Convert everything to a cost per gram or per millilitre. Once each ingredient has a cost per base unit, every recipe can use it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Write a recipe card for each dish
&lt;/h2&gt;

&lt;p&gt;For each dish, list the ingredients and the quantity used for one portion. Multiply each quantity by its cost per unit, then add the waste allowance. The sum is your food cost per portion.&lt;/p&gt;

&lt;p&gt;A useful habit is to write quantities per plate, not per batch. That way the numbers match what actually leaves the kitchen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Set the price from a target food cost
&lt;/h2&gt;

&lt;p&gt;Food cost percentage is food cost per portion divided by the selling price. Many operators work backward from a target percentage. If your target is 30% and a dish costs 45 EGP in ingredients, the suggested price is 45 divided by 0.30, which is 150 EGP.&lt;/p&gt;

&lt;p&gt;The right target depends on your concept, rent, and labour costs, so choose yours deliberately rather than copying someone else's number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Look at the whole menu, not one dish
&lt;/h2&gt;

&lt;p&gt;Price alone does not tell you what to change. Plot each dish by popularity (how often it sells) and profitability (margin per plate). That gives four groups:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stars:&lt;/strong&gt; popular and profitable. Protect them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workhorses:&lt;/strong&gt; popular but thin margin. Try a small price change or a cheaper ingredient swap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Puzzles:&lt;/strong&gt; profitable but rarely ordered. Improve the description or its placement on the menu.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dogs:&lt;/strong&gt; neither popular nor profitable. Consider removing them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the menu engineering matrix. It turns a list of numbers into decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Re-check when costs move
&lt;/h2&gt;

&lt;p&gt;Supplier prices change, and a recipe that worked last quarter can quietly lose money. Re-run the numbers whenever you receive new invoices.&lt;/p&gt;

&lt;h2&gt;
  
  
  The spreadsheet
&lt;/h2&gt;

&lt;p&gt;If you would rather not wire up the formulas yourself, I built an Arabic Excel workbook that follows these steps. It has five sheets: an ingredient list with purchase units and prices, recipe cards with waste percentages, menu pricing against a target food cost, a menu engineering matrix with a recommendation for each dish, and a step-by-step how-to page.&lt;/p&gt;

&lt;p&gt;It has no macros. Input cells are colour-coded, and formulas are protected against accidental overwrites. The protection has no password, so you can unprotect a sheet from the Review tab if you need to change a formula. The example names and prices are fictional; you replace them with your own.&lt;/p&gt;

&lt;p&gt;It costs 99 EGP one-time for buyers in Egypt, paid by InstaPay, or $5 through Gumroad for buyers outside Egypt. Details and a preview are on the product page: &lt;a href="https://sites.alfhardevelopment.com/recipe-sheet/" rel="noopener noreferrer"&gt;https://sites.alfhardevelopment.com/recipe-sheet/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>excel</category>
      <category>business</category>
      <category>restaurant</category>
      <category>productivity</category>
    </item>
    <item>
      <title>pytrends is archived: how I pull Google Trends data in Python now</title>
      <dc:creator>karim alfhar</dc:creator>
      <pubDate>Wed, 07 Oct 2026 15:56:20 +0000</pubDate>
      <link>https://dev.to/alfhar/pytrends-is-archived-how-i-pull-google-trends-data-in-python-now-1hcp</link>
      <guid>https://dev.to/alfhar/pytrends-is-archived-how-i-pull-google-trends-data-in-python-now-1hcp</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I built the Apify actor described in this post. It is a paid actor (pay per event). This article was drafted with AI assistance and reviewed by me before publishing.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you pull Google Trends data in Python, you probably started with &lt;a href="https://github.com/GeneralMills/pytrends" rel="noopener noreferrer"&gt;pytrends&lt;/a&gt;. That repository is now &lt;strong&gt;archived on GitHub&lt;/strong&gt; (read-only, last push August 2024), so open issues will not be fixed.&lt;/p&gt;

&lt;p&gt;On top of that, Google rate limits automated Google Trends requests. Scripts that depend on a scraper library tend to hit HTTP 429 sooner or later, and there is nobody left to patch the library when Google changes something.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I use now
&lt;/h2&gt;

&lt;p&gt;I built an &lt;a href="https://apify.com/alfhar/google-trends-scraper-pro" rel="noopener noreferrer"&gt;Apify actor&lt;/a&gt; that returns Google Trends data as JSON: interest over time, interest by region and related queries, one result per search term. Calling it from Python takes a few lines with &lt;code&gt;apify-client&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;apify_client&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ApifyClient&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ApifyClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;YOUR_APIFY_TOKEN&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;run&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;alfhar/google-trends-scraper-pro&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;run_input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;keywords&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;iphone&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;samsung galaxy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;compareKeywords&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;geo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SA&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;timeRange&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;today 3-m&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;defaultDatasetId&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="nf"&gt;iterate_items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;keyword&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;averageInterest&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;peakDate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the client with &lt;code&gt;pip install apify-client&lt;/code&gt; and use your own Apify API token. &lt;code&gt;compareKeywords&lt;/code&gt; puts up to 5 terms on one shared 0-100 scale, like the Google Trends compare view. &lt;code&gt;geo&lt;/code&gt; takes country or region codes such as &lt;code&gt;EG&lt;/code&gt;, &lt;code&gt;SA&lt;/code&gt;, &lt;code&gt;US-CA&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example output
&lt;/h2&gt;

&lt;p&gt;One dataset item per search term (shortened):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keyword"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bitcoin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"geo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"EG"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timeRange"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"today 12-m"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"averageInterest"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;32.32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"peakDate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-05-03"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"peakValue"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"interestOverTime"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2025-10-05"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Oct 5 – 11, 2025"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"hasData"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"isPartial"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"interestByRegion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"geoCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"EG-JS"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"geoName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"South Sinai Governorate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"relatedQueries"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"top"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="nl"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bitcoin price"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"rising"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="nl"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bitcoin news today"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;484450&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"breakout"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Moving from pytrends
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;pytrends&lt;/th&gt;
&lt;th&gt;JSON field&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;interest_over_time()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;interestOverTime&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;interest_by_region()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;interestByRegion&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;related_queries()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;relatedQueries.top&lt;/code&gt; / &lt;code&gt;.rising&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Values are relative (0-100), exactly like Google Trends itself, not absolute search counts. Related topics are returned by Google only to some clients, so that list is often empty; related queries work.&lt;/p&gt;

&lt;p&gt;A small example client with the same snippet lives here: &lt;a href="https://github.com/alf7ar/google-trends-api-python" rel="noopener noreferrer"&gt;alf7ar/google-trends-api-python&lt;/a&gt; (MIT).&lt;/p&gt;

&lt;h2&gt;
  
  
  Pricing
&lt;/h2&gt;

&lt;p&gt;Pay per event: $0.005 per actor start plus $0.003 per search term that returns data. Terms that fail are not charged. Check the &lt;a href="https://apify.com/alfhar/google-trends-scraper-pro" rel="noopener noreferrer"&gt;actor page&lt;/a&gt; for current prices.&lt;/p&gt;

&lt;p&gt;If something is missing for your use case, open an issue on the actor page and I will take a look.&lt;/p&gt;

</description>
      <category>python</category>
      <category>googletrends</category>
      <category>webscraping</category>
      <category>api</category>
    </item>
  </channel>
</rss>
