web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / "Export" a value to be...
Power Automate
Unanswered

"Export" a value to be used on a website

(1) ShareShare
ReportReport
Posted on by 2
Hey there!
 
We have a Microsoft Forms taking answers. I've made a flow which counts the amount of rows in the underlying Excel file and stores this value in yet another Excel file. What I'm now trying to do is read the value from that Excel file using Javascript in order to show the value on our website.
 
Using Javascript I seem to be unable to read the Excel file directly from OneDrive. Also, there must be an easier way which only uses Power Automate to do what I'm trying to do. Anyone here who can hint me in the right direction?
 
I don't have any Premium features as we are a mere non-profit sports association. 
 
My Javascript which isn't reading the OneDrive Excel file (helped out by ChatGPT:
 
// Laad de SheetJS-library dynamisch
const script = document.createElement("script");
script.src = "https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js";
script.onload = function() {
    // Zodra de SheetJS library geladen is, start het ophalen van de Excel-data
    fetchExcel();
};
document.head.appendChild(script);
// Definieer de fetchExcel-functie
async function fetchExcel() {
    const url = 'https://weespfc-my.sharepoint.com/:x:/g/personal/schoolvoetbal_fcweesp_nl/ESHQUaPEePNFqop0hU77d_wBh3osMcN-hyplXAWSPe0Rhw?e=kIoVdY';
    try {
        const response = await fetch(url);
        if (!response.ok) throw new Error("Kan het Excel-bestand niet ophalen");
        const arrayBuffer = await response.arrayBuffer();
        // Lees het Excel-bestand met SheetJS
        const workbook = XLSX.read(arrayBuffer, { type: "array" });
        // Selecteer Blad1 en de benodigde cel B2
        const worksheet = workbook.Sheets["Blad1"];
        const cellAddress = "B2";
        const cell = worksheet[cellAddress];
        const value = cell ? cell.v : "Geen waarde gevonden";
        // Controleer of het element bestaat en werk het bij
        const outputElement = document.getElementById('outputCounter');
        if (outputElement) {
            outputElement.textContent = value;
        } else {
            console.error("Element met id 'outputCounter' niet gevonden");
        }
    } catch (error) {
        console.error('Fout bij het ophalen van het Excel-bestand:', error);
        document.getElementById('outputCounter').textContent = "Fout bij laden";
    }
}
// Roep fetchExcel elke 30 seconden opnieuw aan
setInterval(fetchExcel, 30000);
 
Categories:
I have the same question (0)
  • Mark Nanneman Profile Picture
    993 Moderator on at
    I don't think you can get the actual file from a sharepoint link formatted like what you have hard coded in your javascript.  

        const url = 'https://weespfc-my.sharepoint.com/:x:/g/personal/schoolvoetbal_fcweesp_nl/ESHQUaPEePNFqop0hU77d_wBh3osMcN-hyplXAWSPe0Rhw?e=kIoVdY';

    notice that there's no .xlsx in the link, it's a link that shows sharepoint where to find your file but it won't return the file content to your javascript.

    You could try using an API call to get the file content:

    https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest#working-with-files-by-using-rest


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 266 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 160 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 134 Super User 2026 Season 2

Last 30 days Overall leaderboard