web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Trying to add data fro...
Power Apps
Suggested Answer

Trying to add data from gallery to Excel spreadsheet

(1) ShareShare
ReportReport
Posted on by 2
I am Power Apps beginner working on a Power Apps that reads questions from a Sharepoint list (using a dropdown box to determine which questions get loaded), adds those questions to a gallery and then allows someone to answer those questions then I want to save the answers to a table in an Excel spreadsheet but I'm struggling to figure out how to add the data.
 
The Excel file has a table already that has a header row as the first row and each column has the question in that header row. Here is an example of part of that table.
 
I have this added as a data source in my app and I can do
ClearCollect(tableCollection, Defaults(Table1));
to get the schema of that table as a collection.
 
The questions from the Sharepoint list are in a gallery, the text label comes from the Sharepoint list and has a text box to put the answer.
 
After clicking a button, all the questions and answers get added to a collection that I was hoping to then use to add to the Excel table.
ClearCollect(questionsCollection, ForAll(textQuestionsGallery.AllItems, {
    question: textQuestionsLabel.Text,
    answer: textQuestionsInput.Text
}));
I was hoping to match each 'question' in the collection to the header name with the same question in the table, add a new row with each answer to the corresponding cell in that row but I cannot figure out how to do this. I can't hard code in the column names because each set of questions will be different, so I need way to dynamically match the questions from the gallery to the table.
Categories:
  • Suggested answer
    narayan225 Profile Picture
    2,547 Moderator on at
    Instead of adding them to collection and then patching them to excel, you can directly patch the data to excel.
    I can see that you are making things very complex with this. You can either create a collection that matches the excel table or directly patch to excel without creating a collection.
     
    Onclick of the button, you can use this formula to patch your data
    Patch(Table1, Defaults(Tabl1), (Question1: value from the text input, Question2: Value from text input))
    Hope this helps.
    Cheers!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard