Get data from other sources
Copy and paste data from another program
You can copy data from other sources such as a text file, a Microsoft Excel worksheet, or a Microsoft Word document to the Clipboard and then paste the data into the spreadsheet.
-
In the application you want to copy from, select the data to copy and click Copy
or, if the program doesn't have this button, press CTRL+C.
-
In the spreadsheet, select the upper-left cell of the area in which you want to paste the data.
Data that you paste will overwrite existing data. To prevent loss of data, make sure the area you paste to is blank, or move the existing data to another location on the spreadsheet.
-
Click Paste
on the toolbar.
Import data from a Web page, text file, or XML file
For best results, the data in the Web page or text file that you want to import should be in a table and must be on the same Web server or computer as your spreadsheet. For example, if the Web page containing your spreadsheet is opened from a Web server, you can import data that resides on that Web server only.
Caution Data is always imported beginning in cell A1 of the spreadsheet. Existing data will be overwritten without warning.
- In the design window, make sure the spreadsheet is activated. For instructions, see Help for your design program.
- Click Commands and Options
on the toolbar, and then click the Import tab.
- In the Data type list, select the type of file you want to import: XML, HTML, or CSV.
- In the URL box, type the address or path of the Web page, text file, or XML file that you want to import, or click Browse
to locate the file.
- Click Import Now.
If you want the spreadsheet to be updated with the latest data from the Web page, text file, or XML file each time the spreadsheet is opened in the browser, select the Refresh data from URL at run time check box.
Notes
- You cannot use this method to import images or controls.
- This command works only in the design program and cannot be run in the browser at run time.
- When you choose to import XML data, only data in the XML-Spreadsheet format is imported.
Create a formula that retrieves data
You can retrieve data in a spreadsheet cell by using one of the OBJECT functions. For example, you can use the CREATEOBJECT function to create an instance of an object that resides on a remote server, and then use the OBJECT function to retrieve data from that object. Or, you can use the HOST function to get data from the application that is hosting the spreadsheet. For example, the following formula gets data from a text box that resides on the same Web page as the spreadsheet:
=HOST().TextBox1.Value
For more information, see Help for CREATEOBJECT, OBJECT, HOST, or XMLDOM.
- In the design window, make sure the spreadsheet is activated. For instructions, see Help for your design program.
- Click Commands and Options
on the toolbar, and then click the Data Source tab.
-
Do one of the following:
Connect the Spreadsheet Component to a data source on the same Web page
- Select a data source in the Data source list under Workbook data connection. If no data sources are available on the Web page, this option is not available.
To connect the active sheet to an individual item in the data source specified for the workbook (such as a table, query, and so on), select Data member in workbook data source under Sheet data connection, and then select the data member in the list.
If you're working in a data access page and you have not yet created a spreadsheet, you can simply drag a table or other data member from the Microsoft Access field list onto the data access page, and follow the instructions in the Layout Wizard to create a spreadsheet that is connected to the table or other item you dragged onto the page.
Connect the active sheet to a data source
-
Under Sheet data connection, select Sheet data source.
- In the Connection box, type the connection string for the data source, or click Edit and follow the directions in the dialog box to connect to the data source you want to use.
- If necessary, type the command text or SQL string you want to use to retrieve data from the data source in the Command text or SQL box.
- Select a data source in the Data source list under Workbook data connection. If no data sources are available on the Web page, this option is not available.