Get data from an Excel workbook attached to an InfoPath form
In this InfoPath demo video you will see how you can retrieve the value of a cell from an Excel workbook that is stored in a file attachment control on an InfoPath form from within the InfoPath form itself.
In recipe 55, you'll learn how to write C# or Visual Basic .NET code to retrieve the value of a cell from an Excel workbook that is attached to an InfoPath form from within the InfoPath form itself.
Get more solutions from InfoPath 2010 Cookbook 5 which is available on Amazon.com
Watch next video: Submit SharePoint List form values to a new Excel workbook
InfoPath demo video transcript:
Here I'm in Excel 2010, where I've got this Fruits Excel workbook that contains the names and colors of fruits. The idea is that I would like to attach this Excel workbook to an InfoPath form, and then from within the InfoPath form, retrieve values that are stored in this Excel workbook.
So as you can see here, we've got cell A2 contains the name Apple and B2 the color Red, A3 contains Banana and B3 Yellow, A4 Kiwi and B4 Brown. Remember these values since I'll be retrieving them from within the InfoPath form.
Here I'm in SharePoint 2010, where I've already published an InfoPath form template to this SharePoint form library. So if I click Add document to add a new form and then I'll attach the Excel workbook that you saw previously to this InfoPath form.
And then what I'll do next is, I'll just enter cell references here. So I'll say A2. And as you can remember, A2 was Apple. And we can retrieve value B2, which would be Red. And if I retrieve A4, which was a Kiwi, I can also retrieve its color B4. And then you'll see Brown will be returned. And A3 contained Banana. And its color was, as you can remember, Yellow.
Related InfoPath Demo Videos:
- Submit SharePoint List form values to a new Excel workbook
- Send an entire repeating table to Excel
- Add the URL of a form as a link to an Excel workbook from within InfoPath
- Perform exact and wildcard searches in an Excel table from within InfoPath
- Update an Excel chart on an InfoPath form
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.