I managed to get ppq.ai running directly in Google Sheets, using a simple Apps Script. I adapted the standard ChatGPT-in-Sheets script to hit the ppq.ai API.
It’s essentially a custom function where you pass the prompt and select cell(s): =PPQ("Summarize this " & A2 & " in 50 words.")
It works flawlessly for standard tasks, like automating data analysis and generating content (yeah, AI-slop).
It's working great for deepseek/deepseek-chat gpt-oss-120band similar models, though I'm still troubleshooting the reasoning models. They don't respond with this basic setup.
If you want to try this yourself, you'll need:
- A Google account, and basic understanding of Google Sheets
- A PayPerQ API Key.
Step 1: Get your API Key
- Got to https://ppq.ai/api-docs.
- Click the copy button next to your API Key.

Step 2: Open Apps Script
- Open a new or existing Google Sheet.
- In the top menu, go to Extensions > Apps Script.
- A new tab will open with the Apps Script editor.

Step 3: Save Your API Key
- Click the Project Settings (gear icon) on the left sidebar.
- Scroll down to the Script Properties section.
- Click Add script property.

- Input:
- Property: PPQ_API_KEY
- Value: (Paste your ppq.ai API key here).
- Click Save script properties.

Step 4: Add the Script
- Click the View Code icon (angle brackets < >) to switch to the code editor view.
- Delete any code currently in the editor (like function myFunction() {...})
- Paste the following script to run DeepSeek V3:
const API_KEY = PropertiesService.getScriptProperties().getProperty('PPQ_API_KEY');
/**
* Calls ppq.ai from Google Sheets.
* @param {string} prompt The text you want to send to the AI.
* @return {string} The AI's response.
* @customfunction
*/
function PPQ(prompt) {
Logger.log('Prompt: ' + prompt);
if (!prompt || prompt.trim() === '') {
return 'Error: Prompt is empty.';
}
const url = 'https://api.ppq.ai/v1/chat/completions';
const options = {
method: 'post',
contentType: 'application/json',
headers: {
Authorization: `Bearer ${API_KEY}`
},
payload: JSON.stringify({
model: 'deepseek/deepseek-chat', // Cheapest model that fits budget
messages: [
{ role: 'user', content: prompt }
],
max_tokens: 600 // INCREASED from 200 to ensure space for the actual text
}),
muteHttpExceptions: true,
followRedirects: true,
validateHttpsCertificates: true,
timeout: 60000
};
try {
const response = UrlFetchApp.fetch(url, options);
const responseText = response.getContentText();
const json = JSON.parse(responseText);
Logger.log('Response Code: ' + response.getResponseCode());
if (response.getResponseCode() === 200) {
if (json.choices && json.choices[0] && json.choices[0].message) {
const message = json.choices[0].message;
// Try to get content
if (message.content && message.content.trim() !== '') {
return message.content.trim();
}
// Fallback for encrypted reasoning issues
if (message.reasoning_details || message.reasoning) {
return 'Error: Model returned reasoning only. Try increasing max_tokens further or use gpt-4o.';
}
return 'Error: Content empty.';
}
} else {
return `Error: ${json.error ? json.error.message : 'Unknown'} (Code: ${response.getResponseCode()})`;
}
} catch (e) {
return `Exception: ${e.toString()}`;
}
}
- Click the Save icon (floppy disk) in the toolbar, or Ctrl+S
- Name the project (optional, but helps to remember), and save again.
Step 5: Run the Function
- Go back to your Google Sheet.
- Click in any cell and type:
=PPQ("Write a haiku about Bitcoin") - Press Enter.
The first time you run it, Google might ask for authorization. Click Review Permissions, choose your account, and if it says "Google hasn’t verified this app," click Advanced > Go to (Untitled project) (unsafe) > Continue.

Step 6: Change the Model (Optional)
The default script runs DeepSeek V3. However, you can also use other models that do not require reasoning. For example, if you want to try gpt-oss-120b, follow these steps:
- Open Apps Script
- In the code editor view, find this line:
model: 'deepseek/deepseek-chat', - Replace
deepseek/deepseek-chatbygpt-oss-120b - Save the file.
Now, the function will run with the new model. And it will use additional credit. You can track the costs on the Account Activity page.
You can find the list of available Model IDs in the ppq.ai documentation and easily copy them.
This setup should have you up and running with ppq.ai in Google Sheets in no time. While it handles standard models like a champ, I'm still working on getting the reasoning models to play nice.
If you have any tips or tricks for tackling those finicky reasoning models, I'm all ears. Your insights could help push this integration even further.