3

so basically, I'm trying to use node.js to scan a google document, then if a ROBLOX id is on there it tracks it. When it tracks it, if it joins one of the groups in the id list, it auto-exiles it.

Any help?

I'm a little stuck on the scanning a google document line by line.

Federico Grandi
  • 6,048
  • 4
  • 23
  • 41
Ross
  • 128
  • 12

1 Answers1

3

I am not sure about how to do it from a google doc, but if you are willing to move to using text files(.txt) I think I could be of assistance.

Using Nodes FS we can read lines using a Line reader

import * as fs from 'fs'
import { createReadStream } from 'fs'
import { createInterface } from 'readline'

const lineReader = createInterface({
  input: createReadStream('data/input.txt')
})

const output: string[] = []

lineReader.on('line', (item: string) => {
  output.push(If you wanna output something to an output file put it here)
})

// Down here is the output of what you put in the output.push

lineReader.on('close', () => {
  fs.writeFile('data/output.txt', output.join('\n'), err => {
    if (err) throw err
    console.log('The file has been saved!')
  })
})

So the above code is in typescript, but typescript can be compiled down into javascript. If this code doesn't work for you I at least hope it gave some knowledge that helped you find your answer.

Aidan el Goste
  • 367
  • 1
  • 3
  • 21