connected-workbooks icon indicating copy to clipboard operation
connected-workbooks copied to clipboard

Can examples can be a little more elaborated ? Errors so far running them.

Open anicolas-richard opened this issue 1 year ago • 2 comments

Hello, I'd love to integrate the library, though I can't manage to do so into a js script runned with Node v21. Every example lead to errors, and for instance : TypeError : generateSingleQueryWorkbook is not a function Maybe the Readme file also outdated with very recent v3 release of the library ? Though, forcing running the 2.1.25 release doesn't help. I hope to get some assistance. Best regards, Antoine

anicolas-richard avatar Apr 27 '24 20:04 anicolas-richard

Hi Antoine,

Can you share a sample project with your issues?

ron-b avatar Apr 28 '24 15:04 ron-b

Hello Ron,

Sure. I basically try to execute one of the README example, using Node (tried latest v20 & v21) :

import workbookManager from '@microsoft/connected-workbooks';
const grid = {
  config: { promoteHeaders:true, adjustColumnNames:true },
  data: [
      ["Product", "Price", "InStock", "Category", "Date"],
      ["Widget A", 19.99, true, "Electronics", "10/26/2024"],
      ["Gizmo B", 9.99, true, "Accessories", "10/26/2024"],
      ["Bubala", 14.99, false, "Accessories", "10/22/2023"],
      ["Thingamajig C", 50, false, "Tools", "5/12/2023"],
      ["Doohickey D", 50.01, true, "Home", "8/12/2023"]
  ]
};
const blob = workbookManager.generateTableWorkbookFromGrid(grid);    
workbookManager.downloadWorkbook(blob, "MyTable.xlsx");

I have several issues with some (maybe normal) workarounds :

  • I need to ass a comma in const grid, between the 2 properties
  • I have to save as a module (mjs extension) to use the 'import' declaration/syntax
  • Though, I still get an error stating 'generateTableWorkbookFromGrid is not a function', which I can't manage to fix.

Hopes this is more clear for you :) I am very looking forward using such a solution to generate Excel files with specific Power Query already built in !

Best regards, Antoine

anicolas-richard avatar Apr 28 '24 17:04 anicolas-richard

Hi Antoine, could you check out the beta version we've just release?

mabezen avatar May 22 '24 07:05 mabezen