cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
york
Helper II
Helper II

Get and update EXCEL data after Submit form

Hi Everyone:

     I have a flow start with a form, and people need to upload 1 excel file when they submit the form, I want to get some fixed cell's info after people upload the excel, such as A1,B1,C1, how can I get them and update it to a table in other excel file?

  Such as:

   1.I have a excel file named "A" in my One drive folder, it has a table named "B"; 

   2. Upload a excel file named "C" when submit the form, it has cells A1,B1 and C1, and B1 is the date, such as "2021-11-27", and the C1 is a link, such as "https://www,google.com";

   3.Get the A1,B1,C1 data in the "C" and then update the data to "B", the A ;

How can I achieve step 3? Looking forward to your reply.

 

1 ACCEPTED SOLUTION

Accepted Solutions
iltoningui
Resolver IV
Resolver IV

Hi @york 

 

I was able to achieve this using the run script action, you need to

1. Create an excel script on web, follow this tutorial 

function main(workbook: ExcelScript.Workbook): ReadData
{
  // get active sheet
  const sheet = workbook.getActiveWorksheet();
  // get data from A1
  let name: string = sheet.getCell(0, 0).getValue() as string;
  // get data from B1
  let date: string = sheet.getCell(0, 1).getValue() as string;
  // logs the operation
  console.log(name)
  console.log(date)
  //creates an object to return the data
  let data: ReadData = new ReadData(name, date);
  return data;
}

class ReadData {
  name: string;
  date: string;

  constructor(name: string, date: string){
    this.name = name;
    this.date = date;
  }
} 

2. Create the flow

iltoningui_0-1638069304890.png

outputs('Run_script')?['body/result/name']

this will get the name attribute returned by the script

 

Hope this helps

 

Consider marking it as a solution

View solution in original post

1 REPLY 1
iltoningui
Resolver IV
Resolver IV

Hi @york 

 

I was able to achieve this using the run script action, you need to

1. Create an excel script on web, follow this tutorial 

function main(workbook: ExcelScript.Workbook): ReadData
{
  // get active sheet
  const sheet = workbook.getActiveWorksheet();
  // get data from A1
  let name: string = sheet.getCell(0, 0).getValue() as string;
  // get data from B1
  let date: string = sheet.getCell(0, 1).getValue() as string;
  // logs the operation
  console.log(name)
  console.log(date)
  //creates an object to return the data
  let data: ReadData = new ReadData(name, date);
  return data;
}

class ReadData {
  name: string;
  date: string;

  constructor(name: string, date: string){
    this.name = name;
    this.date = date;
  }
} 

2. Create the flow

iltoningui_0-1638069304890.png

outputs('Run_script')?['body/result/name']

this will get the name attribute returned by the script

 

Hope this helps

 

Consider marking it as a solution

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,140)