You can use the File Viewer Web Part to display content of files on current page.
Note: The File Viewer web part only working in SharePoint Online modern experience.
Please follow these steps:
1.Create a Modern SharePoint page
Open your SharePoint Online modern site >> click Settings menu >> click Add a page
2.Edit this page
a) Click +
Sign, and then add New section “Two Column” from the Section layout.
b) In the column-section1, click +
sign>> select “Document library” from the web part toolbox>> select the relative Document Library from the list of Document Libraries
c) In the column-section2, click +
sign>> select “File Viewer” from the web part toolbox.
d) After you finish performing step 2, the below screen will appear:
3.Edit the File Viewer Modern Web part
a) After you select the File Viewer Modern Web part >> click Edit Web part option >> click ...
sign on the File viewer pane, and then click “Connect to Source” >> select the relative Document Library
b) When you select a file, the page will display the content of the file.
Thanks,
Echo Du
==============
…………………………Updated Answer…………………………
Please following steps:
1.Go to the Document Library, select Edit page under the Settings menu.
2.Click "Add a Web Part" link >> select "Media and Content" node>> add "Script Editor" web part
3.On the Script Editor web part, click "EDIT SNIPPET" link
4.On the Emned dialog , entry the following script >> click "Insert" Button
5.Click "Stop Editing" button in the top menu bar to save page.
Thanks,
Echo Du
================
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.