how to import data from sharepoint to excel using macro - excel

I wanted to know if there's a way to import data from SharePoint to Excel using Macros. What i want to do is have a library in my sharepoint in which i have an excel document. When i download the document and open it, i would like to automatically import the data from sharepoint and have some graphs.
What i've tried to do is export the data of a list using the SharePoint ribbon. Then i opened the file.dll.iqy in notepad, hoping to find the macros to import datas. What i've found was this :
WEB
1
http://win-sharepoint:9090/sites/PPMO/_vti_bin/owssvr.dll?XMLDATA=1&List={C51D70F2-4D7B-4F20-AE05-379DA264F685}&View={8399F350-92C7-4942- B8B0-464A735AFC72}&RowLimit=0&RootFolder=%2fsites%2fPPMO%2fLists%2fStade%20du%20projet
Selection={C51D70F2-4D7B-4F20-AE05-379DA264F685}-{8399F350-92C7-4942-B8B0-464A735AFC72}
EditWebPage=
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
SharePointApplication=http://win-sharepoint:9090/sites/PPMO/_vti_bin
SharePointListView={8399F350-92C7-4942-B8B0-464A735AFC72}
SharePointListName={C51D70F2-4D7B-4F20-AE05-379DA264F685}
RootFolder=/sites/PPMO/Lists/Stade du projet
I tried to save it as a macro, but the result i got was not the one expected.
Do you have any idea how to do this ?
Thanks a lot

In Excel 2010, you can go to Data / Get External Data / From Web
Then you can browse to your SharePoint List and select your table using the helpful arrow icons.
Similarly, you can open the iqy file with Excel (enabling security on the prompt) then save the new worksheet. You can see the iqy file details under Data / Connections.

Related

Is there a way to scrape data from a Microsoft Form survey?

I am trying to automate my survey analysis pipeline and would like to link the data from a Microsoft Form to an Excel sheet.
This is what the page looks like with results collected:
But you have to click the open in excel to get the table of results. I was wondering if it would be possible to automate this so that it updates to capture all responses like once a day into an Excel sheet...this is what the output looks like when you click the button.
Any tools or tips would be great! I have some experience with R and Python so could implement that too...
Forms is already linked to an excel file, the "Open in Excel" button is a link to the excel file, which is saved either in files on your teams channel or in sharepoint.
The data is in a table automatically, and on sharepoint you can link between tables in different spreadsheets using the Data -> Get Data menu in excel.

How to import data from XLSX file hosted on SharePoint Online (not lists)?

TL;DR: I'm looking for the equivalent of Excel 2019's Get Data > From File > From Workbook functionality, but where "workbook" is hosted on SharePoint online.
This seems so simple but yet after hours of searching I cannot find anything remotely close. This question does not relate to SharePoint Lists (or file lists). I am literally needing to read data from one online spreadsheet and place into another.
I have three Excel documents hosted on SharePoint Online:
Revenue Tracker.xlsx
Cost Tracker.xlsx
Time Tracker.xlsx
I need to create a fourth file, that analyses the data from the above files, for example to cross-reference revenue against hours.
Based on solutions online, I've tried the following within Excel:
Data > Get Data > From File > From SharePoint Folder
That provided a list of documents located in that SharePoint folder.
Data > Get Data > From Online Services > From SharePoint Online List
Not what I'm looking for.
Create share link in Revenue Tracker.xlsx, then in new file Get Data > From Other Sources > From Web > Paste Url
Error: Access to the resource is forbidden. Even though I am correctly logged into Excel using my work SharePoint credentials.
You can import data from Excel stored in SharePoint to Excel desktop by using Get Data > Web option.
Paste the path to the Excel file in the the URL bar that appears.
EXAMPLE:
https://community.powerbi.com/t5/Desktop/Import-Data-from-an-Excel-sheet-in-SharePoint/td-p/47223

How to programmatically create a list from an excel spreadsheet in SharePoint 2010?

I want to create a list from an excel spreadsheet in SharePoint 2010. When a new Excel document is uploaded to a SharePoint library, a corresponding list will be created automatically. Is this possible?
You can do this in two phases:
Create an empty MS Access database and import your excel sheet into it (in MS access go to External data -> Excel, choose your file and follow the steps to import it.
When you get the MS access table with the data from excel sheet, right click the table name in Tables section and go to Export -> SharePoint list. There you can specify the url of your SharePoint site and the name of the new list. Click Ok and wait until the list is created and the data is uploaded to SharePoint.
EDIT:
Since this needs to be done automatically (as stated in comments), this is the high overview of the things that needs to be done, with some useful links:
Create Event receiver for the library that the excel files will be uploaded to.
In the ItemAdded Method write the code that will do the following:
Get the uploaded file
Parse the excel file using the OpenXml library
Create the list in the SharePoint site, based on the columns taken from the excel file
Loop through all the rows in the excel file and insert the list item for each excel row.

Using a JIRA saved filter with REST API and Excel

I have a report that I need to update in Excel many times a day using statistics from JIRA. If I can import these directly with code I would save a lot of time and effort.
Is it possible to use a saved JIRA filter in conjunction with the REST API function to import the results to Excel using a VBA macro?
This is a solution does not use REST API, but it may work for you. This is a workaround I am using so far and it works:
Run the Filter in Jira
Export the result list into an excel file using the Export CSV file with the option current field (to avoid having unnecessary fields) and with the right button of mouse select: Open in a new window
Now you will see the URL associated with your filter in a new window of your browser. Your filter is represented by a Filter ID, therefore the query will be always the same.
Go to excel and use the URL as a hyperlink
Every time you click on the hyperlink it will download the file from Jira. You need to have a Jira open sesion in your browser.
Create a VBA marco that click on the hyperlink for downloading the file.
Use Power Query for example for loading the file from the download folder location into a worksheet. Power Query is a new excel feature. Power Query is an ETL tool integrated into excel for loading files and processing them.
The steps 6-7 automates the process. Run the Marco for downloading the file and refresh the content of your worksheet from Data Connection. You can have an additional macro that refreshes the content of the worksheet. It refreshes all pivot tables and the file connection for reading the file.
Hint: Use excel Table for keeping the information updated automatically when additional information is loaded into the worksheet. If you use pivot tables for presenting the data, use as data source an excel table instead of excel range.
It minimizes a lot the manual effort.
Here you can find a solution that uses REST API, the author provides the source code, but it is more complicated. If you need something simple, my solution may work for you.

Sharepoint Lists to Word / Excel file

Is their anything in sharepoint to easily achieve this?
Say you have a list of 40 items, you can click a button to export all 40 items right to a word file or text file or something. Instead of having to open each item and click print.
I can do something custom wise, im just curious if there is a simple solution already implemented.
If you have Office 2007 installed and you visit a SharePoint list, you can just use the Actions > Export to Excel option (or Export to Spreadsheet). This generates a SharePoint Excel Query File that Excel can open up and pull the list.
Most Office apps, especially Excel, will talk to SharePoint lists in some form or another.
You should be able to do this already, provided you have MSOffice.
When viewing the list, hit the "actions" button at top and you should have "Export to Spreadsheet" available, this will drop the full list right into excel.

Resources