Hi GPT Builders.

I have built a GPT that does exactly what I want it to do from a workflow perspective. It first asks the user specific questions, then generates data, then populates an excel template from its knowledge with more detailed data.

The issue I am having is that I need the excel template to be populated with roughly 100 lines of data but the GPT will only ever populate 5-20 lines then adds something similar to the following “# Continue to add up to row 113 with the same structure of data”.

No matter what prompts I try, I cannot get the GPT to complete the entire task. Does anyone know how to get around this? Maybe I am approaching it in completely the wrong way?

Here is an example of the code block output which shows its laziness:

import openpyxl

Template Setup: Load the provided Excel workbook

workbook_path = ‘/mnt/data/TEMPLATE.xlsx’
workbook = openpyxl.load_workbook(workbook_path)

Access the specific worksheet

worksheet = workbook.active

Populate initial project data

worksheet[‘C4’] = “FMCG Corporation” # Name of the organization
worksheet[‘C5’] = “ERP Modernization” # Project Name
worksheet[‘C6’] = “S/4 HANA Implementation” # Change Initiative
worksheet[‘F6’] = “Implementing SAP S/4 HANA to improve efficiency and data accuracy.” # Description of the change

Define the detailed impacts and populate the rows

detailed_impacts = {
14: (“Integration of Legacy Systems”, “Current multiple ERPs”, “Single integrated platform”, “Global”, “USA”, “Corporate HQ”, “IT”, “IT Manager”, “Yes”, “No”, “No”, “200+”, “High”),
15: (“Data Migration Accuracy”, “Prone to errors”, “High accuracy and consistency”, “Global”, “USA”, “Data Centers”, “IT”, “Data Specialist”, “No”, “Yes”, “No”, “300+”, “High”),
16: (“Data Security Enhancements”, “Basic security protocols”, “Advanced security frameworks”, “Global”, “USA”, “Corporate HQ”, “IT”, “Security Analyst”, “No”, “Yes”, “Yes”, “100+”, “High”),
17: (“System Downtime During Transition”, “Minimal”, “Scheduled outages”, “Global”, “USA”, “All Locations”, “Operations”, “Operations Manager”, “No”, “No”, “Yes”, “500+”, “Medium”),
# More impacts would follow this pattern…
}

Populate the worksheet with detailed impacts

for row, details in detailed_impacts.items():
impact, current, future, region, country, location, function, role, glg, els, ppl, people_impacted, impact_magnitude = details
worksheet[f’B{row}‘] = impact
worksheet[f’C{row}’] = current
worksheet[f’D{row}‘] = future
worksheet[f’G{row}’] = region
worksheet[f’H{row}‘] = country
worksheet[f’I{row}’] = location
worksheet[f’J{row}‘] = function
worksheet[f’K{row}’] = role
worksheet[f’L{row}‘] = glg
worksheet[f’M{row}’] = els
worksheet[f’N{row}‘] = ppl
worksheet[f’O{row}’] = people_impacted
worksheet[f’R{row}'] = impact_magnitude

Save the updated workbook

output_path = ‘/mnt/data/Updated_TEMPLATE.xlsx’
workbook.save(output_path)
print(“Excel template has been successfully updated and saved to”, output_path)

1 Like

It is this part that I am trying to solve. This placeholder is always present in the output, regardless of how I instruct the GPT to complete the code block with no placeholders.

If it’s always the same, can’t you strip it out on your end?

Or tell it what to use for the heading?

Thanks Paul!

The GPT successfully generates 50-100 “headings” so it knows what to put in column A for every single row. It is also successful at populating all of the correct data for each of the first rows and puts this data into the exact correct cells. So it is not that the GPT doesn’t know what to do. It clearly does. It just does not complete the task. I assume because the task is too long. It might take 10 minuted to write out every line so it assumes the user would like a faster answer and shortens the task but adding in the placeholder.

I have given the GPT an example of the desired output in its instructions which has not placeholder and every single row written out in full. So I am unsure how I could strip this out from my end.

Ah, assumed it was API even though you have it as a Custom GPT. Sorry about that!

Yeah, the longer and more detailed the instructions, the harder it is to follow still.

Maybe try simplifying a bit?

Ah, thanks again Paul.

Yes, I’m sure it will work well if I can simplify. The issue is, there is not much value to the user unless I can populate the full data.

I haven’t really used the API. Do you think there is a better way to build this using the API insteaed?

Likely. With Assistants API… maybe break it down to easier steps…

Are you familiar with coding at all?

1 Like

I can’t code but I have been using Grimoire quite a bit which has helped with some simple coding.

Yeah, I think it being lazy happens more when it’s running high on tokens…

Hrm…

Could maybe compile the data with an action on your end? Could still use a Custom GPT then…

Would need a server and script/code to do it…

…113 lines might be too much, though, for a Custom GPT… which is why it’s saying / inferring it can’t do more…

2 Likes

OK, thanks, that makes sense. I’ll have a look into that. I can get the GPT to do all of the rows, 5 or 10 lines at a time but yes, struggle to get it compiled and therefore populated in the template.

Wen GPT5?! :smile:

1 Like

Yeah, you’re running into the CustomGPTs Context Window.

If you need a user other than yourself to create with this, then I think you’re pretty stuck with the ChatGPT User Interface until you’re comfortable building an API Assistant with a friendly UI of your own.

The Context Window is pretty artificial and grows all the time, as it just did with the release of 4o. So you’re CustomGPT will be able to do it all in one go sooner or later, maybe even now once the new model is fully released. You have more control over this with the API—as for example knowing exactly how much of the Window you’re using for a prompt.

Meanwhile, you’ll have to break your project into smaller chunks with multiple responses required to fill the spreadsheet.

For creating Actions that link directly to your Google Sheet, see this thread. It’s pretty dope.

2 Likes

When the ai becomes lazy I usually say : write a full working (code) so that I don’t make a mistake with copy pasting.
You could try something like:: please write the list in full to avoid duplications or overlaps.
I notice that if you justify your requests it’s more compliant.

2 Likes

The GPT has a severe token constraint. If you replicate this, even in the Assistant Playground, you’ll likely find it much more successful.

2 Likes

Tell it to get into “continue processing mode” - after 24 lines it should start writing “affirmative” but before that it should write another 23 lines but before that it should write another 22 lines and follow that pattern until it reaches 1 lines. Then add another 24 lines and try to repeat the procedure 3 times…

If that doesn’t work YELLING and insulting and bribing might work too.

The new GPT4o model is close to working. The Assistant API does seem better but I cannot add an .xlsx document to the file search. I get this error: “Could not attach files to vector store: Files with extensions [.xlsx] are not supported for retrieval”

Do you have any idea how I can use the API to pull a .xslx template and then populate it and return the updated document to the user as a downloadable link?

Nope! Not a clue. Though that’s an interesting problem.

I know in the CustomGPTs, you have to enable the Data Analysis tool to be able to upload xlsx, and I suspect it’s similar.

You could also convert your spreadsheet to .csv or a literal text file and have the model understand it that way. After all, you only need the columns and stuff?

I’d ask in the API section. There’s surely a way to use spreadsheets.

1 Like