1

I have a requirement to fetch 2 large lists and merge data into a single CSV file. Suppose Lists are as below :

List A

  • Column1

  • Data1

  • Data2

List B

  • Column2

  • Data3

  • Data4

Then Data should be displayed in csv file as below :

  • Column1 Column2
  • Data1 Data3
  • Data2 Data4

Is there any way to achieve this using REST/JSOM ?

Please note that as per the requirement we want to do it multiple times so there should not be any manual work to do.

1 Answer 1

1

This could easily be done via PowerShell. Check out the get-pnplistitem cmdlet, in conjunction with the export-csv cmdlet.

7
  • This does not help me, we need a script in JSOM/REST to perform this as mentioned in the question clearly. Commented Feb 19, 2019 at 4:51
  • There is a pnp js library as well. Here is a page with samples: github.com/SharePoint/PnP-JS-Core/wiki/Basic--Operations. Once you have the data, you can generate a csv: stackoverflow.com/questions/14964035/… Commented Feb 19, 2019 at 13:19
  • Thanks for the references Mike but I am very much struggling to fulfill this and references of complete raw data are not helping me here. If possible please post a sample code so I can modify that and use. Commented Feb 19, 2019 at 14:39
  • That's why i orginally posted the powershell, it's the simplest way. If you need the javascript route, you'll need a way to get js on the page. In a modern page, that means either SPFx, or the modern script editor web part, which is an open source part available here: github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/… - Once you are able to get script on the page, you'd need to reference the pnp js. Once that's done, then the rest shouldnt be too bad, as the above links have samples. Commented Feb 19, 2019 at 14:42
  • I am working on classic experience so that is not a problem. I will look into PnP libraries and will update here. Commented Feb 19, 2019 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.