title: Upload Excel data to Microsoft SQL Server
body: <p>I am trying to read excel data and insert it into a SQL Server database. I am using npm package <code>mssql</code> to do the same. Also using XLSX to read Excel data.</p>
  <p>However I keep getting the same error</p>
  <blockquote>
  <p>ErrorMessageToken {
  name: 'ERROR',
  event: 'errorMessage',
  number: 102,
  state: 1,
  class: 15,
  message: 'Incorrect syntax near '?'.',
  serverName: 'myservername',
  procName: '',
  lineNumber: 1 } },
  name: 'RequestError',
  number: 102,
  lineNumber: 1,
  state: 1,
  class: 15,
  serverName: 'myservername',
  procName: '',
  precedingErrors: [] }</p>
  </blockquote>
  <p>My code:</p>
  <pre><code>const filePath = path.join(__dirname, 'demo.XLSX')
  const workbook = XLSX.readFile(filePath)
  const [firstSheetName] = workbook.SheetNames
  const worksheet = workbook.Sheets[firstSheetName]
  
  const rows = XLSX.utils.sheet_to_json(worksheet, {
      raw: true, // Use raw values (true) or formatted strings (false)
      header: 1, // Generate an array of arrays (&quot;2D Array&quot;)
  })
  
  const pool = await connect({
      user: process.env.dbUser,
      password: process.env.dbPassword,
      server: process.env.dbServer,
      database: process.env.dbName,
      options: {
              encrypt: true,
              enableArithAbort: true,
      },
  })
  
  const query = `INSERT INTO TableName (Col1, Col2, Col3, Col4, Col5) VALUES ?  `
  const result = await pool.request().query(query, [rows])
  // also tried ...rows, [[rows]], [rows.values()]
  console.log(result)
  </code></pre>
  <p>Any help is much appreciated. Thank you</p>
  <p>EDIT: tried using bulk insert as well but no sucess, tried single inserts which are working fine but as soon as I move to multiple inserts, it gives an error. Any other ways I can achieve the task if this approach is not working?</p>